Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
41
Task/JSON/Ada/json-2.adb
Normal file
41
Task/JSON/Ada/json-2.adb
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;
|
||||
with League.JSON.Arrays; use League.JSON.Arrays;
|
||||
with League.JSON.Documents; use League.JSON.Documents;
|
||||
with League.JSON.Objects; use League.JSON.Objects;
|
||||
with League.JSON.Values; use League.JSON.Values;
|
||||
with League.Strings; use League.Strings;
|
||||
|
||||
procedure Main is
|
||||
|
||||
function "+" (Item : Wide_Wide_String) return Universal_String
|
||||
renames To_Universal_String;
|
||||
|
||||
JSON_String : constant Universal_String
|
||||
:= +"{""name"":""Pingu"",""born"":1986}";
|
||||
|
||||
Penguin : JSON_Object;
|
||||
Parents : JSON_Array;
|
||||
|
||||
begin
|
||||
Penguin.Insert (+"name", To_JSON_Value (+"Linux"));
|
||||
Penguin.Insert (+"born", To_JSON_Value (1992));
|
||||
|
||||
Parents.Append (To_JSON_Value (+"Linus Torvalds"));
|
||||
Parents.Append (To_JSON_Value (+"Alan Cox"));
|
||||
Parents.Append (To_JSON_Value (+"Greg Kroah-Hartman"));
|
||||
|
||||
Penguin.Insert (+"parents", To_JSON_Value (Parents));
|
||||
|
||||
Put_Line (To_JSON_Document (Penguin).To_JSON.To_Wide_Wide_String);
|
||||
|
||||
Penguin := From_JSON (JSON_String).To_JSON_Object;
|
||||
|
||||
Parents := Empty_JSON_Array;
|
||||
|
||||
Parents.Append (To_JSON_Value (+"Otmar Gutmann"));
|
||||
Parents.Append (To_JSON_Value (+"Silvio Mazzola"));
|
||||
|
||||
Penguin.Insert (+"parents", To_JSON_Value (Parents));
|
||||
|
||||
Put_Line (To_JSON_Document (Penguin).To_JSON.To_Wide_Wide_String);
|
||||
end Main;
|
||||
Loading…
Add table
Add a link
Reference in a new issue