I'm using a program to build game levels with Box2D through exported JSON files but am having trouble with certain elements in the JSON file that tend to have multiple formats.
One "body" element for example has the position
property that consists of an x
and a y
value:
"position" :
{
"x" : 0,
"y" : 0
},
Then later in the file another element has the position
property that has no x
or y
, only a single number value:
"position" : 0,
I've tried things akin to if(element is Number || element is Object)
to no success.