Jerome
Jerome

Reputation: 1192

Namespaces in JSON

Is there such a thing as JSON namespaces, just like XML namespaces? Has anyone created a spec or libraries for this? Is this a good or a terrible idea?

I want to make a data spec that can be represented in XML as well as JSON. However I also need the namespace concept, that the data can be extended by annotations in different vocabularies.

To be more specific, this is about representing events. My schema will describe the event in basic terms (time and location), though if you think about it, events can be annotated with different information e.g. attendees or image URLs which I don't want to specify in my schema.

Upvotes: 14

Views: 21301

Answers (3)

Balint Bako
Balint Bako

Reputation: 2560

This is quite an old thread, but there are JSON prefixes, which are almost like namespaces. If you are using Java server-side with Jettison, you can easily meet them.

Upvotes: 0

redben
redben

Reputation: 5686

JSON-LD might help :

"JSON-LD (JavaScript Object Notation for Linking Data) is a lightweight Linked Data format that gives your data context."

Upvotes: 6

Russ Clarke
Russ Clarke

Reputation: 17909

JSON Schema might be the right thing for this:

http://json-schema.org/

Althought I don't know how well it's implemented.

Upvotes: 2

Related Questions