How would you use the TJSONXXX classes to parse this JSON:

How would you use the TJSONXXX classes to parse this JSON:

{
"result":
[
{
"MecYear":"0",
"10YrSurrIndexCurr":"0.00",
"10yrSurrIndexGuar":"0.00",
"20yrSurrIndexCurr":"0.00",
"20yrSurrIndexGuar":"0.00",
"Message":"None",
"Error":""
}
]
}

It's a response from a datasnap request. I tried using a JSON pair with the "result" begin the name part and the array being the value part (only one element in the array) . Then in the array is another JSON Object. But I'm getting confused..

Comments

  1. TJSONXxxx should have a isNull, usInteger, isArray... and so on. No?

    ReplyDelete
  2. Dany Marmur There is already Null which checks for IsNull. One can still use TryGetValue to check for compatibility with a specific type. That might even be preferred when handling enumeration types which are represented as strings inside JSON. Besides that one can ask for value is TJSONArray and others.

    ReplyDelete
  3. Got it. Thanks.. JSON Object , JSON Pair, JSON Array, and then Json Object

    ReplyDelete

Post a Comment