Json: Displaying \\?\Volume{guid} from string to json giving error

Created on 9 Dec 2019  路  2Comments  路  Source: nlohmann/json

  • Describe what you want to achieve.
    Want to convert a string let's say _\\?\Volume{1651d5ac-0000-0000-0000-501f00000000}\_ in json
  • Describe what you tried.
    Tried to convert a string to json _"{\"mods\": [{\"volume\": \"\\?\Volume{1651d5ac-0000-0000-0000-501f00000000}\\"}]}"_
    Gives an error while json.parse as

[json.exception.parse_error.101] parse error at line 1, column 34: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '"\?\V'

  • Describe which system (OS, compiler) you are using.
    Windows 10, VS2017
  • Describe which version of the library you are using (release version, develop branch).
    version 3.5.0
question

Most helpful comment

If the string is hard-coded inside the code, are the backslashes escaped correctly?

See this example: https://wandbox.org/permlink/Pka92SX9ChjWYlVL

All 2 comments

If the string is hard-coded inside the code, are the backslashes escaped correctly?

See this example: https://wandbox.org/permlink/Pka92SX9ChjWYlVL

Thanks

Was this page helpful?
0 / 5 - 0 ratings