I'm using Delphi XE2 with DBXJSON
and I'm having trouble handling a JsonArray contained inside a String. The String I got is this:
"[
{DAT_INCL: \"2/3/2012 16:45:9\", NUM_ORDE: 1, NUM_ATND: 734, NUM_ACAO: 2, NUM_RESU: 3},
{DAT_INCL: \"2/3/2012 16:45:10\", NUM_ORDE: 2, NUM_ATND: 734, NUM_ACAO: 4, NUM_RESU: 5},
{DAT_INCL: \"2/3/2012 16:45:10\", NUM_ORDE: 3, NUM_ATND: 734, NUM_ACAO: 8, NUM_RESU: NULL}
]"
Goddamn quotation marks.
No matter how hard I try, I can never get my hands on this array, no ParseJSONValue
and no crazy type juggling could get the array out of this quotation-mark prison.
Maybe one of you got the key?
EDIT: This string is already the result of a bit of type conversion. In case anyone is interested in seeing how I extracted this string, maybe to find a better way to finally get the array out (he's really lonely and scared), here's how I did it:
Originally, I had a two-pair TJsonObject
named jObject
{
"id": 0,
"data": "[{DAT_INCL: \"08/03/2012 10:07:08\", NUM_ORDE: 1, NUM_ATND: 1, NUM_ACAO: 2, NUM_RESU: 3},
{DAT_INCL: \"08/03/2012 10:07:09\", NUM_ORDE: 2, NUM_ATND: 1, NUM_ACAO: 4, NUM_RESU: 5},
{DAT_INCL: \"08/03/2012 10:07:09\", NUM_ORDE: 3, NUM_ATND: 1, NUM_ACAO: 8, NUM_RESU: NULL}]"
}
I proceeded to extract the relevant TJsonPair
, named jPair:
jPair := jObject.Get(1);
Which nets me this:
"data": "[{DAT_INCL: \"08/03/2012 10:07:08\", NUM_ORDE: 1, NUM_ATND: 1, NUM_ACAO: 2, NUM_RESU: 3},
{DAT_INCL: \"08/03/2012 10:07:09\", NUM_ORDE: 2, NUM_ATND: 1, NUM_ACAO: 4, NUM_RESU: 5},
{DAT_INCL: \"08/03/2012 10:07:09\", NUM_ORDE: 3, NUM_ATND: 1, NUM_ACAO: 8, NUM_RESU: NULL}]"
From that, I extracted the String
, named sString
sString:= jPair.JsonValue.ToString;
Which nets me that string on the start of the question. And that is as good as it got, so far.