• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how do I convert json to json-ld

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to make a call to a service that expects json-ld, and I only have json. What is the process in order to convert json to json-ld. Given that I have the context the service uses, say www.example.com/test/core.json-ld and www.example.com/test2/core.json-ld,
is there some library magic that will just accept json and context as a parameter and spit out json-ld?

From what I have been reading, it seems very possible to convert json > json-ld, I am still new to this and can't seem to find an easy solution. It sounds like all the json needs is a context, but I am still unsure of how to do this.

I want something like

{
"id": 1,
"name": "A green door",
"price": 12.50,
}

to be

{
@context{
test : www.example.com/test/core.json-ld
test2 : www.example.com/test2/core.json-ld
}
"id": 1,
"test:name": "A green door",
"test2:price": 12.50,
}
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Googled for "json-ld" and found http://json-ld.org/ which has links at the bottom to implementations for various programming languages, among which a Java library: https://github.com/jsonld-java/jsonld-java

Maybe that will be useful.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic