Is there any way to set reference of one JSON object to another?
JSON doesn't have any mechanism to reference/include JSON in other files. You manually have to edit the JSON and insert your other JSON there. Or load both JSON files with whatever language you are processing the data in, and write some custom logic to merge the data in that language.
In a JSON schema, a $ref keyword is a JSON Pointer to a schema, or a type or property in a schema. A JSON pointer takes the form of A # B in which: A is the relative path from the current schema to a target schema. If A is empty, the reference is to a type or property in the same schema, an in-schema reference.
You can't. You can specify the path to the parent as a string and evaluate that at runtime, but as JSON is just strings, integers, arrays, and dictionaries, you can't use references.
It is a common mistake to call a JSON object literal "a JSON object". JSON cannot be an object. JSON is a string format. The data is only JSON when it is in a string format.
Short answer: NO
JSON is a very simple data representation format. It contains no support for references within the overall object. May be you could hack up a little, but it will still be up to the program parsing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With