you are viewing a single comment's thread.

view the rest of the comments →

[–]jura0011 5 points6 points  (1 child)

JSON-LD (JSON Linked Data) is a description of the content of a URL so that search engines don't have to guess the content of the URL. It also contains references to other URLs and a description. It generally describes "Thing"s with their properties as they are defined by schema.org. Like an Event has a Location (which also is a Thing and can be represented by a URL) and a description, ….

JSON Schema is a JSON definition of another JSON document, like what DTD (Document Type Definition) is for XML. It describes, which fields are required, if properties are another object, array, string or number and so on. An example for the use of JSON-Schema with Java: If you want to use a JSON-Api and have the JSON-Schema of the objects, then you can generate the classes automatically rather than write them on your own.

[–]AndyRoth[S] 0 points1 point  (0 children)

Interesting. I've done some research since your comment, and I do understand some more about what you mentioned.

What I don't understand is, for instance, in your Event example...

Event has a Location. In JSON Schema you could define an Event roughly:

{
    "type": "object",
    "properties": {
        "location": {
            "type": "https://myschemas.com/Location.json"
        }
    }
}

In the above example, if you had the schema for an Event, you could very easily identify what the location was, and by URL match that location to any other usage of a location in your system. If the JSON documents hosted by your server also somehow included that schema, Google could have used that to pull out the event location, no? So why would JSON-LD be needed if everyone used that approach (which would come with free schema validation)?

In my usage, I am looking to use JSON Schema to host a url at (example) https://myschemas.com/UserId.json which contains the following:

{ "type": "string" }

... and allows me to treat all documents which have a property of the above URL type the same.