Answer the question
In order to leave comments, you need to log in
How to describe data types using JSON?
Hello.
There are several services written in different languages: Java, Ruby. Interservice communication occurs through Kafka, HTTP and DB. In the case of HTTP and DB, the transfer format is JSON and this sometimes leads to problems because different languages and their libraries serialize/deserialize their data types to/from JSON in different ways. Ruby, when serializing to JSON, casts Decimal to a string by wrapping the value with a quote. But Java serializes Decimal to JSON, in fact, as a number, i.e. without quotes. Example.
Ruby: Decimal->JSON = "1.0"
Java: Decimal->JSON = 1.0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question