I have a JSON response that I need to parse into an object in ASP.Net (Vb.net or c#), but I don't see any examples for a nested response string and how to parse (only simple value pairs).
Here's one:
{
"ticker": {
"high": 3.494,
"low": 2.9,
"avg": 3.197,
"vol": 463260.58724,
"vol_cur": 143878.12481,
"last": 2.924,
"buy": 2.959,
"sell": 2.925,
"updated": 1387635241,
"server_time": 1387635242
}
}
from one site, and another one here:
{
"result": "success",
"return": {
"high": {
"value": "745.00000",
"value_int": "74500000",
"display": "$745.00",
"display_short": "$745.00",
"currency": "USD"
},
"low": {
"value": "610.00000",
"value_int": "61000000",
"display": "$610.00",
"display_short": "$610.00",
"currency": "USD"
},
"avg": {
"value": "664.21299",
"value_int": "66421299",
"display": "$664.21",
"display_short": "$664.21",
"currency": "USD"
},
"vwap": {
"value": "658.47213",
"value_int": "65847213",
"display": "$658.47",
"display_short": "$658.47",
"currency": "USD"
},
"vol": {
"value": "29333.04107565",
"value_int": "2933304107565",
"display": "29,333.04 BTC",
"display_short": "29,333.04 BTC",
"currency": "BTC"
},
"last_local": {
"value": "645.00000",
"value_int": "64500000",
"display": "$645.00",
"display_short": "$645.00",
"currency": "USD"
},
"last_orig": {
"value": "645.00000",
"value_int": "64500000",
"display": "$645.00",
"display_short": "$645.00",
"currency": "USD"
},
"last_all": {
"value": "645.00000",
"value_int": "64500000",
"display": "$645.00",
"display_short": "$645.00",
"currency": "USD"
},
"last": {
"value": "645.00000",
"value_int": "64500000",
"display": "$645.00",
"display_short": "$645.00",
"currency": "USD"
},
"buy": {
"value": "638.36000",
"value_int": "63836000",
"display": "$638.36",
"display_short": "$638.36",
"currency": "USD"
},
"sell": {
"value": "644.98500",
"value_int": "64498500",
"display": "$644.99",
"display_short": "$644.99",
"currency": "USD"
},
"item": "BTC",
"now": "1387644090735676"
}
}
I downloaded Json.Net (looks good), but it looks like it only supports non-nested JSON strings (at least the examples do). They show arrays, but these are not arrays as such.
I thought about doing a sort of manual parsing using string manipulation and regular expressions, but would rather have something I can reuse. Just not sure where to start.