Insert data with quotes

Hi,

The data I am trying to insert in dgraph has double quotes in it. How do i preserve the quotes when the data is stored in Dgraph?

This gives error

{
  set{
    _:792636 <uid> _:792636 .
    _:792636 <name> "Test "quotes" .
  }
}

where this inserts the backslash as well

{
  set{
    _:792636 <uid> _:792636 .
    _:792636 <name> "Test \"quotes" .
  }
}

Also what are the other characters that would create problems?

Any help would be appreciated.

Hey, Sarita. I saw your topic and thought it was another case. BTW, you should use the preformatted text code to paste any Dgraph code or other lang code.

Well, the escape patterns are the same as JSON. In the case, you should escape and unescape yourself at the application level.

Backspace is replaced with \b
Form feed is replaced with \f
Newline is replaced with \n
Carriage return is replaced with \r
Tab is replaced with \t
Double quote is replaced with \"
Backslash is replaced with \\

Cheers.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.