Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
So this tripped me up. I was reading a url that returned a json with a BOM, online json validators reported it as valid json but php's json_decode() was returning null.
I found the solution here :
http://stackoverflow.com/questions/9232109/json-encode-returning-null-fo...
While this solution can easily be implemented as a custom parser, I thought it might be useful for wsdata to be able to deal with it by default.
Patch incoming.
Comment | File | Size | Author |
---|---|---|---|
#2 | remove_utf8_bom_json-2660508-2.patch | 596 bytes | ptsimard |
Comments
Comment #2
ptsimard CreditAttribution: ptsimard commentedHere is the patch adding this code to wsdata_simple_json.wsdata.processor.inc:
Comment #3
ptsimard CreditAttribution: ptsimard commentedComment #4
dmitryVL CreditAttribution: dmitryVL at DEWEB Studio for Drupal Ukraine Community commentedAlso have the same problem and use that(http://stackoverflow.com/questions/9232109/json-encode-returning-null-fo...) solution, so looks good and move to rtbc.
Comment #6
spotzero CreditAttribution: spotzero as a volunteer and at Coldfront Labs Inc. commentedFix committed.