How can I specify one to many and many to one relations in json-ld. For example :
{
"@context" : {
"@vocab" : "http://www.schema.org/",
"@id" : "http://www.example.com/users/Joe",
"name" : "name",
"dob" : "birthDate",
"age" : {
"@id" : "http://www.example.com/users/Joe#age",
"@type" : "Number"
}
"knows" : ["http://www.example.com/users/Jill", "http://www.example.com/users/James"]
},
"name" : "Joe",
"age" : "24",
"dob" : "12-Jun-2013"
}
this doesn't parse in json-ld playground. What is the valid and best way to specify relations like this either in json-ld or using Hydra?
You need to be carful what you put into the context and what you put into the body of the document. Simply speaking the context defines the mappings to URLs while the body contains the actual data. Your example should thus look something like this: