question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why does JsonMatcher accept an invalid JSON string?

See original GitHub issue

It 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:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
StefHcommented, Aug 7, 2020

Parsing the code in the constructor : you can try this in preview MyGet : WireMock.Net.1.2.17-ci-13680.nupkg

0reactions
StefHcommented, Aug 12, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found