Is it possible to process request that has a minor problem with JSON format?
astrekalova opened this issue · 5 comments
I am developing a server in Golang that accepts openRTB requests. Some of the requests that our partners are sending to the server contain minor problems with JSON validity like a wrong type of hyphen ("user":{"customdata":"48474fea-0aa1-45e1-8817-c5070e27448b”}). This kind of problem leads to an error in decoding with json package and initializing a openrtb.BidRequest struct. Is there a way to ignore a field that is not valid but still extract correct information from a request?
I'm not sure that I understand your point. The problem was that the wrong hyphen character was used, so that the json was invalid syntactically. "customdata" is just an example, it could easily be any other field.
If the JSON is invalid syntactically the only option is to correct it before feeding to json.Unmarshal
.
That said hyphen is not a part of JSON syntax, so not sure how it can be wrong.
Hi, I don't quite understand the issue with validity. To me, it looks like "user":{"customdata":"48474fea-0aa1-45e1-8817-c5070e27448b”}
example should pass just fine. What is exactly the problem?