I am tasked with determining the relationship between the two web applications. I decided to use JSON for this. How common is this in the root of a node in JSON?
Say we have a car. This is JSON with "Car" being the root of the node:
{"Car": { "Make":"Mustang", "YearBuilt":"1999"}}
So, now let's say that I have a Tire object, and since we are standardizing the presence of root nodes, this should also have it.
{"Tire": {"Make": "Brirdgestone", "Size":"15"}}
Integrating a JSON bus object into the original Car object shows how bulky it is.
{"Car": { "Make":"Mustang", "YearBuilt":"1999", "Tires": "[{"Tire": {"Make": "Brirdgestone", "Size":"15"}}, {"Tire": {"Make": "Brirdgestone", "Size":"15"}}, {"Tire": {"Make": "Bridgestone", "Size":"15"}}, {"Tire": {"Make": "Brirdgestone", "Size":"15"}} ]}}
Thus serialized in PHP, the first of the buses will be $object->Car->Tires[0]->Tire->Make . There is an additional layer of Tire because of the root node.
If Tire does not have a root root, the code can be much more subtle.
{"Car": { "Make":"Mustang", "YearBuilt":"1999", "Tires": "[{ {"Make": "Bridgestone", "Size":"15"}}, {"Make": "Brirdgestone", "Size":"15"}}, {"Make": "Brirdgestone", "Size":"15"}}, {"Make": "Brirdgestone", "Size":"15"}}]}}
There is less confusion in PHP because there is less redundancy: the first bus brand is called $object->Car->Tires[0]->Make
Is there anything bad without having a root root? I like having the root directory of the node, because it acts like a class name, but unnecessary levels change me a lot, and that will make moving more complicated.