attribute datatype

Started by jeg, March 14, 2018, 10:01:59 PM

Previous topic - Next topic

jeg

When I use the v1/attributes endpoint I get all values as strings, regardless of the defined datatype in Imatch. Would it be possible the keep the right datatypes? It is annoying to get "0"/"1" for Boolean, especially when I use typescript. There I define a Boolean variable for type safety reasons and cannot compare with "0" or "1".

Mario

#1
IMatch delivers all Attribute values as strings. This was a design decision because this is how IMatch internally works with Attributes. It converts them on-the-fly into whatever data type is required.
You can determine the data type of each Attribute via the attributes/schema endpoint and then use the built-in conversion routines in JavaScript to do the conversion as needed.

If you consider this to be a problem, feel free to add a feature request for a future IMatch version.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook