Skip to content

coercing the type of a nested node in a plain JSON document #267

Closed
@ghost

Description

I am processing plain JSON documents of the form:

{
"propertytype1" : {
"key1" : "value1"
}
}

I want to coerce the "@type" of the nested node value, but I don't see an example in the spec nor can I achieve this in the playground.

My attempt at a context is:

"@context" : {
"propertytype1" : {
"@id" : "http://example.org/propertytype1",
"@type" : "http://example.org/PType1"
},
"@vocab" : "http://example.org/"
}

The compact form generated in the playground is:

{
"http://example.org/propertytype1": {
"http://example.org/key1": "value1"
}
}

What I am trying to achieve is:

{
"http://example.org/propertytype1": {
"@type" : "http://example.org/PType1",
"http://example.org/key1": "value1"
}
}

Is it possible to achieve this, if not how do people generally apply contexts to nested JSON documents to get typed node values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions