JSON.NET Error Self referencing loop detected for type

That was the best solution https://docs.microsoft.com/en-us/archive/blogs/hongyes/loop-reference-handling-in-web-api Fix 1: Ignoring circular reference globally (I have chosen/tried this one, as have many others) The json.net serializer has an option to ignore circular references. Put the following code in WebApiConfig.cs file: The simple fix will make serializer to ignore the reference which will cause a loop. However, it … Read more

JSON.parse() not working

I dont think you should call JSON.parse(jsonObject) if the server is sending valid JSON as it will be parsed automatically when it retrieves the response. I believe that if You set the Content-type: application/json header it will be parsed automatically. Try using jsonObject as if it was already parsed, something like: Without calling JSON.parse before.

How do you represent a JSON array of strings?

I’ll elaborate a bit more on ChrisR awesome answer and bring images from his awesome reference. A valid JSON always starts with either curly braces { or square brackets [, nothing else. { will start an object: Hint: although javascript accepts single quotes ‘, JSON only takes double ones “. [ will start an array: Hint: spaces among elements are always ignored by any JSON parser. And value is an object, array, string, number, bool or null: … Read more

Simplest way to read JSON from a URL in Java

This might be a dumb question but what is the simplest way to read and parse JSON from URL in Java? In Groovy, it’s a matter of few lines of code. Java examples that I find are ridiculously long (and have huge exception handling block). All I want to do is to read the content … Read more

Parse Json string in C#

I’m using Json.net in my project and it works great. In you case, you can do this to parse your json: EDIT: I changed the code so it supports reading your json file (array) Code to parse: Output: BTW, you can use LinqPad to test your code, easier than creating a solution or project in … Read more