Why does JsonMatcher accept an invalid JSON string?
See original GitHub issueIt appears that the JsonMatcher
constructor accepts an invalid JSON string, and swallows the parsing exception.
Is there a valid use case for this behavior? As far as I can tell, it still won’t properly match an invalid JSON string. For me, the preferred behavior would be to let the caller know right away that the string is not valid JSON.
I would be happy to submit a pull request with this change, but I wanted to make sure I’m not missing something.
Thank you much, this is a fantastic tool that we use every day!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
I've received an "Invalid JSON string" error. What do I do?
An invalid JSON error can occur for many reasons. The most common issue is usually associated with a file upload attempt, and can...
Read more >Why is my JSON invalid even though it looks correct?
3 Answers. The issue is that the string contains a newline as a literal, which should be \n . In most languages you...
Read more >Invalid json with line breaks in array repeat expander #165
Given this json and using the JsonMatcher : { "id": "@number@", "name": "@string@", ... It's JSON that does not allow multiline strings.
Read more >How to Fix the Invalid JSON Error in WordPress
In this article, learn how to fix the invalid JSON error - 'Updating failed. The response is not a valid JSON response.' with...
Read more >Invalid JSON string error? : r/forge
I put in my account info for xbox live and it tells me Invalid JSON string and and says it couldnt log me...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Parsing the code in the constructor : you can try this in preview MyGet :
WireMock.Net.1.2.17-ci-13680.nupkg
I also think that throwing exception in constructor is correct. You get this exception immediately when adding a invalid mapping.
Later today I will merge PR and create new official release.