* JSON and interpreting JSON objects
@ 2015-03-13 13:15 tonyg
2015-03-13 15:07 ` Björn Lundin
0 siblings, 1 reply; 5+ messages in thread
From: tonyg @ 2015-03-13 13:15 UTC (permalink / raw)
I'm playing with some JSON. I am trying to pick some information out of a JSON object but am trying to understand what I am doing first.
In the following code I am not totally sure about displaying a JSON object, and I was wondering what to put in "when JSON_Object_Type =>" I want to traverse over the object and print the information out if you didn't manage to guess what I was trying to do
CODE>>>
with GNATCOLL.JSON; use GNATCOLL.JSON;
procedure Output_Json (JV : in Json_Value) is
begin
case Kind(Val => JV) is
when JSON_Array_Type =>
for count in 1..JV.Length loop
Output_Json (JV.Get(count));
end loop;
when JSON_Object_Type =>
when JSON_Null_Type =>
TP.Put_Line("JSON_NULL_TYPE");
when others =>
TP.Put_Line(JV.Get'Image);
end case;
end Json_Stuff;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: JSON and interpreting JSON objects
2015-03-13 13:15 JSON and interpreting JSON objects tonyg
@ 2015-03-13 15:07 ` Björn Lundin
2015-03-13 16:03 ` tonyg
2015-03-16 12:01 ` tonyg
0 siblings, 2 replies; 5+ messages in thread
From: Björn Lundin @ 2015-03-13 15:07 UTC (permalink / raw)
On 2015-03-13 14:15, tonyg wrote:
>
>
> I'm playing with some JSON. I am trying to pick some information out of a JSON object but am trying to understand what I am doing first.
> In the following code I am not totally sure about displaying a JSON object, and I was wondering what to put in "when JSON_Object_Type
Have a look in Gnatcoll.Json.Write
In there, they do what you want - printout of a JSON, testing on
different types, JSON_Object_Type included.
in gnatcoll.Json spec, there is
subtype JSON_Container_Value_Type is JSON_Value_Type range
JSON_Array_Type .. JSON_Object_Type;
which indicates that it is some kind of container.
--
Björn
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: JSON and interpreting JSON objects
2015-03-13 15:07 ` Björn Lundin
@ 2015-03-13 16:03 ` tonyg
2015-03-16 12:01 ` tonyg
1 sibling, 0 replies; 5+ messages in thread
From: tonyg @ 2015-03-13 16:03 UTC (permalink / raw)
On Friday, 13 March 2015 15:07:18 UTC, björn lundin wrote:
> On 2015-03-13 14:15, tonyg wrote:
> >
> >
> > I'm playing with some JSON. I am trying to pick some information out of a JSON object but am trying to understand what I am doing first.
> > In the following code I am not totally sure about displaying a JSON object, and I was wondering what to put in "when JSON_Object_Type
>
> Have a look in Gnatcoll.Json.Write
> In there, they do what you want - printout of a JSON, testing on
> different types, JSON_Object_Type included.
>
> in gnatcoll.Json spec, there is
>
> subtype JSON_Container_Value_Type is JSON_Value_Type range
> JSON_Array_Type .. JSON_Object_Type;
>
> which indicates that it is some kind of container.
>
> --
> Björn
Thanks Bjorn!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: JSON and interpreting JSON objects
2015-03-13 15:07 ` Björn Lundin
2015-03-13 16:03 ` tonyg
@ 2015-03-16 12:01 ` tonyg
2015-03-16 13:11 ` tonyg
1 sibling, 1 reply; 5+ messages in thread
From: tonyg @ 2015-03-16 12:01 UTC (permalink / raw)
I've been looking at it.
I've coded something up to use the code in gnatcoll-json i.e. Go get some json data from a web service then print it out.
Now I can see the JSON output , the labels to the data and the data.
I can see how the data values are put in the output string. I seem to be missing something though because I cannot for the life of me see how the data labels are output. I know they are there because I have built and run code to output them, but I can only see the data in the code being output.
Can you see where in gnatcoll-json this is done?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: JSON and interpreting JSON objects
2015-03-16 12:01 ` tonyg
@ 2015-03-16 13:11 ` tonyg
0 siblings, 0 replies; 5+ messages in thread
From: tonyg @ 2015-03-16 13:11 UTC (permalink / raw)
Sorted it out, Got my panties in a twist. Now untwisted.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-16 13:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 13:15 JSON and interpreting JSON objects tonyg
2015-03-13 15:07 ` Björn Lundin
2015-03-13 16:03 ` tonyg
2015-03-16 12:01 ` tonyg
2015-03-16 13:11 ` tonyg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox