[fpc-pascal] FCL-JSON: Getting the data into pascal classes
Reimar Grabowski
reimgrab at web.de
Fri Dec 7 18:26:42 CET 2012
Hi,
I have a relatively simple JSON object consisting of some integer and string fields and a large (500-500000 entries) float array.
Following the parsedemo.pp I extract the values from JSON and put them in my pascal class. All works as expected only that I do not seem to find a method to copy the complete float array from the TJSONArray object to an array of double in one go. I can do it manually by traversing the array but wouldn't it be more convenient to have this functionality in TJSONArray (same for string, integer and other arrays). Am I missing something?
On another note. There is no automatic way to create an instance of a custom class from a TJSONObject or is there?
JSON: {"fooStr":"foobar","fooInt":700,"fooFloatArray":[1.1, 1.2, 1.3]}
Pascal:
TMyCustomClass = class
fooStr: String;
fooInt: Integer;
fooFloatArray: array of double;
end;
Thanks for any info on this matter.
R.
More information about the fpc-pascal
mailing list