Forum Discussion
colomba
New Contributor
Thank You for your response. It is numeric but I don't understand why it strips any response regardless of type. It should return exactly what is returned by service.
richie
4 years agoCommunity Hero
Hey colomba,
If its numeric type then normal numeric handling in most tools will remove any zero digits that are the last digits in the sequence.
E.g. if its numeric then id expect '99.0120' to be presented as '99.012', rather than '99.0120' cos this is standard numeric handling to remove zero digits that dont impact the value.
When i say "dont impact the value", numerically, '99.0120' is the same numeric value as '99.012'
However if the value is of string type then '99.0120' is a different value to '99.012' and this is why zero digits are maintained in string types.
I cant remember whether you mentioned if youre using xml or json. I thunk youre using json, but just in case. Xml instances dont maintain datatypes like json do. That is, if you consider an element in xml, such as:
<elementName>123.090</elementName>, here you cant tell if the value is actually a string or a numeric. This would be defined in the schema.
Whereas with json, datatypes are revealed to a point. Due to fact that there are only 4 primitive json datatypes:
String
Numeric
Boolean
Null
This means you cant always tell the datatype of the content by looking at it.
"stringAttribute": "123.010"
"numericAttribute": 123.01
"booleanAttribute": true
"nullAttribute": null
The basic rules for the datatypes are:
If the value is wrapped in quotes, then its considered a string, even if the value appears to be made up of numbers.
Boolean attributes can only have either true or false values (no quote marks otherwise, it'd be a string, not boolean)
Null attributes can only have the value null....no quote marks.
You might see datetime values and think the datatype is a datetime type like you get in xml, but thats incorrect. The datetime value is wrapped in quotes so its a string!
I kmow i went on a bit then and i havent fixed your soapui issue but hopefully this bit od background info will help going forward.
Ta
Rich
If its numeric type then normal numeric handling in most tools will remove any zero digits that are the last digits in the sequence.
E.g. if its numeric then id expect '99.0120' to be presented as '99.012', rather than '99.0120' cos this is standard numeric handling to remove zero digits that dont impact the value.
When i say "dont impact the value", numerically, '99.0120' is the same numeric value as '99.012'
However if the value is of string type then '99.0120' is a different value to '99.012' and this is why zero digits are maintained in string types.
I cant remember whether you mentioned if youre using xml or json. I thunk youre using json, but just in case. Xml instances dont maintain datatypes like json do. That is, if you consider an element in xml, such as:
<elementName>123.090</elementName>, here you cant tell if the value is actually a string or a numeric. This would be defined in the schema.
Whereas with json, datatypes are revealed to a point. Due to fact that there are only 4 primitive json datatypes:
String
Numeric
Boolean
Null
This means you cant always tell the datatype of the content by looking at it.
"stringAttribute": "123.010"
"numericAttribute": 123.01
"booleanAttribute": true
"nullAttribute": null
The basic rules for the datatypes are:
If the value is wrapped in quotes, then its considered a string, even if the value appears to be made up of numbers.
Boolean attributes can only have either true or false values (no quote marks otherwise, it'd be a string, not boolean)
Null attributes can only have the value null....no quote marks.
You might see datetime values and think the datatype is a datetime type like you get in xml, but thats incorrect. The datetime value is wrapped in quotes so its a string!
I kmow i went on a bit then and i havent fixed your soapui issue but hopefully this bit od background info will help going forward.
Ta
Rich
Related Content
- 6 years ago
- 9 years ago
Recent Discussions
- 15 years ago