How do you tell if a JSON object is an array or not? How do you tell if a JSON object is an array or not? json json

How do you tell if a JSON object is an array or not?


This page shows you how to tell JSON.NET to force xml elements to always produce arrays. That way, you won't have to guess what type it is.


So it looks to me like you have a couple of options:

  1. Find out how many elements are in paramFile. I can't help wondering if it has a .Length rather than a .length (case). This would suggest it does. http://msdn.microsoft.com/en-us/library/system.array.length(v=vs.110).aspx
  2. Force it to become one or the other by altering the xml as suggested by rdodev.
  3. Force it to become one or the other in c# - although by the time you do this and figure out what kind of errors it gives you, you're going to have a test you can work with.

I'm not a C# programmer, but the question caught my interest.