I'm using an XML datasource in an app. One of the fields called quantity
is sometimes zero, thus:
<quantity>0</quantity>
However, when I try and get that value, the actual value in the JSON data structure isn't 0
, it's just absent. Other fields show up with the $t
element inside them, but this one doesn't:
'item' :{
'quantity' :{},
'name' :{'$t' : 'ItemName'}
}
I'd like to pick()
out that value and determine whether it's a positive number (if it's zero, I do something else). How can I do that?
EDIT: When there is a normal numeric value, the XML looks like this
<quantity>100</quantity>
and the JSON looks like this
'quantity' :{'$t' :100}
This is how it should be.