comp.lang.ada
 help / color / mirror / Atom feed
* GNATCOLL JSON Parsing
@ 2018-06-08  5:52 eduardsapotski
  2018-06-08  9:35 ` Björn Lundin
                   ` (14 more replies)
  0 siblings, 15 replies; 41+ messages in thread
From: eduardsapotski @ 2018-06-08  5:52 UTC (permalink / raw)


I try understand parsing JSON in Ada. 

For example:
Have web-api that gives simple JSON: http://api.exmo.com/v1/trades/?pair=BTC_USD&limit=10

I need to save this data to database.
Created type:

   type Money is delta 0.00000001 range 0.0 .. 9_999_999_999.9;
   type UTC_Date is range 1_500_000_000 .. 3_000_000_000;

   type Trade is record

      Trade_Id   : Integer;
      Pair       : Unbounded_String;
      Trade_Type : Unbounded_String;
      Price      : Money;
      Quantity   : Money;
      Amount     : Money;
      Date       : UTC_Date;
      Saved      : Boolean;

   end record;

Created collection:

    package Vector_Trades is new Ada.Containers.Vectors(Natural, Trade);

    Trades : Vector_Trades.Vector;

Receive data:

JSON : Unbounded_String;

JSON := To_Unbounded_String(AWS.Response.Message_Body (AWS.Client.Get (URL => "http://api.exmo.com/v1/trades/?pair=BTC_USD&limit=10")));

What to do next? How to get list of objects from the JSON-text?

How to save data to database already understood.

Thanks.







^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2018-12-04 13:47 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08  5:52 GNATCOLL JSON Parsing eduardsapotski
2018-06-08  9:35 ` Björn Lundin
2018-06-08 10:40 ` eduardsapotski
2018-06-08 12:00 ` Per Sandberg
2018-06-08 15:19 ` eduardsapotski
2018-06-08 15:26   ` Björn Lundin
2018-12-03 15:02   ` Olivier Henley
2018-12-03 18:06     ` Dmitry A. Kazakov
2018-12-03 18:45       ` Olivier Henley
2018-12-03 20:54         ` Dmitry A. Kazakov
2018-12-03 22:01           ` Olivier Henley
2018-12-03 18:06     ` briot.emmanuel
2018-12-03 19:12       ` Olivier Henley
2018-12-03 19:43         ` briot.emmanuel
2018-12-03 20:48           ` Olivier Henley
2018-12-03 20:56             ` Olivier Henley
2018-12-04  7:25             ` briot.emmanuel
2018-12-04 13:39               ` Olivier Henley
2018-12-04 10:14             ` gautier_niouzes
2018-12-04 13:47               ` Olivier Henley
2018-06-08 15:58 ` eduardsapotski
2018-06-08 16:35 ` eduardsapotski
2018-06-08 17:09   ` Björn Lundin
2018-06-09  4:33   ` gautier_niouzes
2018-11-27  6:22   ` Per Sandberg
2018-06-09  4:37 ` gautier_niouzes
2018-06-09  5:08 ` eduardsapotski
2018-06-09  5:31 ` eduardsapotski
2018-06-12  9:55   ` R Srinivasan
2018-06-09  5:35 ` eduardsapotski
2018-11-26  6:42 ` eduardsapotski
2018-11-26 10:17   ` Björn Lundin
2018-11-26 15:56     ` Simon Wright
2018-11-26 16:11       ` eduardsapotski
2018-11-26 18:01         ` Simon Wright
2018-11-26 20:32           ` Björn Lundin
2018-12-03 18:10   ` Simon Wright
2018-11-26 10:26 ` eduardsapotski
2018-11-26 10:50 ` eduardsapotski
2018-11-26 16:16 ` eduardsapotski
2018-11-27  1:47 ` eduardsapotski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox