feat(json): add option to encode decimals as string
Due to inconsistency of Tarantool type casting while using strict data types as "double" or "unsigned" it is needed to use "number" data type in a whole bunch of cases. However "number" may contain "decimal" that will be serialized into string by JSON builtin module. This commit adds "encode_decimal_as_number" parameter to json.cfg{}. That forces to encode `decimal` as JSON number to force type consistency in JSON output. Use with catious - most of JSON parsers assume that number is restricted to float64. NO_DOC=we do not host doc
Showing
- changelogs/unreleased/encode-decimals-as-json-num.md 4 additions, 0 deletionschangelogs/unreleased/encode-decimals-as-json-num.md
- src/lua/serializer.c 1 addition, 0 deletionssrc/lua/serializer.c
- src/lua/serializer.h 5 additions, 0 deletionssrc/lua/serializer.h
- test/app-tap/json.test.lua 15 additions, 1 deletiontest/app-tap/json.test.lua
- third_party/lua-cjson/lua_cjson.c 27 additions, 2 deletionsthird_party/lua-cjson/lua_cjson.c
Loading
Please register or sign in to comment