Entity reference for JSON

518 views Asked by At

I was wondering, is there something similar to entity reference substitution for JSON ? Let say i have the following JSON file

{
   "sql1": "select * from ?? where date = 20030405",
   "sql2": "select * from ?? where date = 20030708",
   "table":"tab1"
} 

How can i substitute the value of the key "table", which is "tab1" at the appropriate place in the values for the keys "sql1" and "sql2" ?

1

There are 1 answers

0
aleksamarkoni On BEST ANSWER

If I understand you correctly, you can find more info here:

http://json-spec.readthedocs.org/en/latest/reference.html

and here is an example

A JSON Reference is a mapping with a unique key $ref, which value is a JSON Pointer. For example, this object:

{
  "foo": {"$ref": "#/bar"},
  "bar": true
}

Can be resolved as:

{
  "foo": true,
  "bar": true
}