Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSON serialization with forward slash '/'

See original GitHub issue

Hope all is well!

Just updated to the latest release and noticed an issue with JSON serialization. The following:

map {
  'uri': "test/test"
} => json:serialize()

results in:

{ "uri": "test\/test" }

I would have expected:

{ "uri": "test/test" }


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

apb2006commented, Aug 25, 2016
map {
  'uri': "test/test"
} => json:serialize(map{"escape":false()}) Version 8.4 Updated: unescape changed to escape.

james-jwcommented, Aug 25, 2016

That must have changed recently? Never worked like that before nor does it any other JSON library I use including Javascript itself, any browser or .NET. I don’t use Java much so maybe that’s the catch.

For example in node or any browser this works as expected:

JSON.stringify({ uri: "test/test" })

resulting in { uri: "test/test"}

How would I produce: { “uri”: “”, }

Hopefully we can go with the XQuery spec as the JSON one is wonky and there is no need for this escaping which most libraries ignore.

The only argument for doing this is easily embedding JSON in script tags, but it seems silly to enforce a rule for a process that is rarely done. I don’t think I have ever embedded JSON in a script tag. 😃

it would be great if there was a way to decide which to use, like an option.

Cheers either way!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON: why are forward slashes escaped? - Stack Overflow
The JSON spec says you CAN escape forward slash, but you don't have to.
Read more >
When serializing a message tree the JSON parser escapes forward slash characters so that values such as "http://myURI" appear as.
Read more >
Ability to serialise JSON without escaping forward slashes #381
According to the description at, unescaped forward slashes (solidus) are legal characters in the JSON ...
Read more >
JSON serialize issue for field names containing slash `/` [Call ...
Hello everyone, I am using kernel method while converting internal table content to JSON. However, if there is a `/` character in the...
Read more >
SerializeJson() Escapes Forward-Slashes In ColdFusion
This is a bug in the implementation of serializeJson(), most likely due to Adobe misreading the JSON spec/RFC. Slashes don't need to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found