How to deal with different encodings in one JSONe?

Good day, colleagues.

I encountered one problem, which at first glance seemed ridiculous, but it's been many hours and no longer funny.

The bottom line:
within the framework , which we write in the project (by the way, if anyone is interested in IOT, then this is what we do uses Apache Avro for conversion , generation and validation schemes.

We have some IDs "uuid" which is generated and recorded directly in these schemes to uniquely identify different records.

But the problem is that these identifiers within libraries Apache Avro written as binary data (byte[]) encoded in Latin-1. And now just imagine, we have all the schema that are stored in the form of Jason, which is all good, except that all the fields "uuid": "...bin some data in latin-1..." . This results in a mixture of two encodings : UTF-8 and Latin-1.

Here another problem if we export the schema and then try to zaimportuj ago - we need to parse this JSON to validate some of the highlights. But we have invalid JSON , since the specification says that JSON should be only in UTF encoding.

Libraries that can parse JSON—č or fall with the exception that there is not UTF-8 or distort Latin-1 , which makes this identity is totally different. My goal is this - to take a byte[] , parse it as JSON to run across nodes, something to check, insert and remove, and again to return byte[] does not distort the existing identifiers in Latin-1 .

I was thinking of going the other way is to write a class that inherits for Avro JsonDecoder (which creates a problem of this encoding), but was there closed construtora or batch level. Thought to make a wrapper - but again, this class is used so I need some methods that I cannot override. And in some places I would need to implementing some interfaces, I'm sure this would draw the string dependency ))

I would appreciate any ideas how to solve this problem!
July 8th 19 at 12:12
1 answer
July 8th 19 at 12:14
write in any format

Who hinders to change a schema after you create it programmatically?
Thank you for your response. The fact that I'm on the project until 2 weeks, still not sure it's that simple and again will not pull a line. When I suggested to my architect that option, supposedly after generating iDisk to recode them at least in Base64 - he refused - gregoria commented on July 8th 19 at 12:17
: what's the reason for the refusal? - mercedes commented on July 8th 19 at 12:20

there is not the same problem? - mercedes commented on July 8th 19 at 12:23
the default UUIDConversion, we need her to do apparently.
Judging by the source code and the info on the link - mercedes commented on July 8th 19 at 12:26

Find more questions by tags ApacheJSONJava