I am trying to read my JSON result.
Here is my RootObject
public class RootObject
{
public int id { get; set; }
public bool is_defau
That's because the json you're getting is an array of your RootObject
class, rather than a single instance, change your DeserialiseObject
to be something like DeserialiseObject
(un-tested).
You'll then have to either change your method to return a collection of RootObject
or do some further processing on the deserialised object to return a single instance.
If you look at a formatted version of the response you provided:
[
{
"id":3636,
"is_default":true,
"name":"Unit",
"quantity":1,
"stock":"100000.00",
"unit_cost":"0"
},
{
"id":4592,
"is_default":false,
"name":"Bundle",
"quantity":5,
"stock":"100000.00",
"unit_cost":"0"
}
]
You can see two instances in there.