0

I want to mock some api calls, so I need to do

String output = jsonOutput

json output can be

{
    "glossary": {
        "title": "example glossary",
        "GlossDiv": {
            "title": "S",
            "GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
                    "SortAs": "SGML",
                    "GlossTerm": "Standard Generalized Markup Language",
                    "Acronym": "SGML",
                    "Abbrev": "ISO 8879:1986",
                    "GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
                        "GlossSeeAlso": ["GML", "XML"]
                    },
                    "GlossSee": "markup"
                }
            }
        }
    }
}

How can I direclty assign them to the string? I tried to use "@", but it is not really working

weijia_yu
  • 965
  • 4
  • 14
  • 31
  • 2
    Possible duplicate of [Can I escape a double quote in a verbatim string literal?](https://stackoverflow.com/questions/1928909/can-i-escape-a-double-quote-in-a-verbatim-string-literal) – zneak Oct 12 '17 at 00:22
  • You really can't as quotes need to be escaped anyway as shown in post linked by @zneak ... If you need it for real usage - just construct JSON from objects as needed or store as files (either just file or embedded resources). – Alexei Levenkov Oct 12 '17 at 01:36

0 Answers0