[fpc-pascal] Read JSON from file
Michael Van Canneyt
michael at freepascal.org
Fri Aug 7 09:46:08 CEST 2015
On Fri, 7 Aug 2015, Chris Moody wrote:
> On 08/06/2015 07:01 PM, leledumbo wrote:
>>> I download a file from a server that contains JSON code. I'm not sure how
>> to read it into something that GetJSON is able to handle.
>> Can't you figure out from the function interface:
> Dentist.pas(56,18) Error: Incompatible type for arg no. 1: Got "TStringList",
> expected "TStream"
> This is what I get when I use:
> function ReadJSON (jsonfile, node:string) : string;
> json: tStringlist;
> J: TJSONData;
> J:=GetJSON(json); // Error is here.
> ReadJSON := J.FindPath(node).AsString;
> Does this mean my Lazarus / FPC is out of date? Or I'm using the wrong
> library or something?
GetJSON doesn't allow a Tstrings argument. Where did you get that from ?
Please check the sample code I sent.
More information about the fpc-pascal