Difference between revisions of "fcl-json"

From Lazarus wiki
Jump to navigationJump to search
(→‎Streaming: If you do this, you can change all links for all language versions... This is the English language version so suggest instead you translate this page to German)
Line 9: Line 9:
  
 
== Streaming ==
 
== Streaming ==
fcl-json contains the unit fpjsonrtti which is used to load objects from or save them to JSON format.
+
fcl-json contains the unit "fpjsonrtti" which is used to load objects (TObject instances) from or save them to JSON format.
  
 
See [[Streaming JSON]] for a short example.
 
See [[Streaming JSON]] for a short example.

Revision as of 08:02, 15 February 2015

fcl-json - a JSON (Javascript Object Notation) implementation

Notes

Contains the fpjson JSON manipulation unit.

Note: In FPJSON, accessing e.g. SomeJSONObject.Integers['price'] may give a SIGSEGV/Access Violation if that integer variable does not exist. This is apparently intentional, see [1]

You'd have to use the .Find method (available since FPC 2.6.2) to first check if the element/variable (price in this example) exists.

Streaming

fcl-json contains the unit "fpjsonrtti" which is used to load objects (TObject instances) from or save them to JSON format.

See Streaming JSON for a short example.

Examples

Example usage can be found in the Lazarus jsonviewer tool.

Also, the fpctwit library makes use of JSON to send/receive data.

See also

An article covering use of XML and JSON in FreePascal: [2]

Package List