W3C home > Mailing lists > Public > public-linked-json@w3.org > February 2016

Example of using json-ld from Java

From: Viggo Navarsete <viggo.navarsete@gmail.com>
Date: Thu, 18 Feb 2016 21:11:01 +0000
Message-ID: <CADtfDAPknRA-bFNE-sJsOMJ1CL=p+2LdE25ohq1puxhT8MW-2g@mail.gmail.com>
To: public-linked-json@w3.org
Question also sent to IRC channel:
Hi, is there someone who can help me with parsing json-d from Java? I see
that from javascript it's relatively easy to traverse the json-ld
structure, see this example:
http://www.autoidlabs.org.uk/GS1Digital/Demos/GS1vocab/gs1JSON-LD-with-JavaScript.html.
But I'm always ending up casting to several layers of LinkedHashMap to get
to the data I want to use/test. Am I modelling things wrong or using
Expansion/Compaction/Flattening/Framing in a way that makes me end up with
all these LinkedHashMaps I need to "unpack" to get to the level in the
json-ld structure I want to read?
This is an example where I've tried to fetch an attribute from a json-ld
structure from java, and I used flatten algorithm first (even not sure if
that is best practise), and as you can see it's not as elegant as done in
Javascript :( http://pastie.org/10727293

Regards,
Viggo Navarsete
Received on Friday, 19 February 2016 10:35:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:47 UTC