JSON inheritance

I wasn;t able to really find much on the subject, but is there any movement or proposals for inheritance in JSON?

I’ve actually been trying to answer the same question for the last week and I came across this:Jackson JSON Processor, altho this might not be useful if you’re not in Java land…

You can also compose JSON objects to achieve something like inheritance:


{ 
    "derived": {
        "base": {
                   "a_string":"AYBABTU",
                    "a_number":99
                     },
        "a_number": 100,
        "a_string":"I'm derived!"
    }
}

>>  object.a_number
>> 100
>> object.base.a_number
>> 99


The data’s all there – however you have to handle the ‘hiding’ function yourself, or write a wrapper class that flattens the data for you.

What’s the application?

I saw the jackson thing too, but java killed it.

Not sure of an actual application just yet. I’ve seen stuff like BSON in mongo and thought maybe folks might try to extend JSON a little. I’m sure you could write a little python wrapper for all this, just use the dict stuff (setdefault, update, etc.) and you could probably get close.