Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of escaping of " #290

Open
stensmo opened this issue Sep 9, 2024 · 1 comment
Open

Incorrect handling of escaping of " #290

stensmo opened this issue Sep 9, 2024 · 1 comment

Comments

@stensmo
Copy link

stensmo commented Sep 9, 2024

using JSON3

#=

Put this content in the file test.json

{
"objects": [
{
"a": 1,
"b": "here is a sting"
},
{
"b": "here is a string with a quote "",
"a": 1
}
]
}

=#

#json_string = """{"objects":[{"a":1,"b":"here is a sting"},{"b":"here is a string with a quote "","a":1}]}"""
json_string = read("test.json", String)

!isfile("types.jl") && JSON3.writetypes(json_string, "types.jl"; module_name=:MyModule, root_name=:Root, mutable=false)

!isdefined(Main, :MyModule) && include("types.jl")

rootObject =JSON3.read(json_string, MyModule.Root)

@stensmo
Copy link
Author

stensmo commented Sep 9, 2024

Note that the quote in the line: here is a string with a quote " should be escaped with a backslash, but that is not included in the text. This escaping problem may cause multiple different errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant