Line breaks in JSON
bachmeier
no at spam.net
Thu May 10 18:21:17 UTC 2018
On Thursday, 10 May 2018 at 17:59:26 UTC, jmh530 wrote:
> On Thursday, 10 May 2018 at 15:01:57 UTC, rikki cattermole
> wrote:
>> [snip]
>>
>> You'll need to unescape them (which is pretty easy, a simple
>> replacement here).
>>
>> For reference, this is invalid json[0]:
>>
>> ```
>> {
>> "1
>> 2
>> 3 "
>> }
>> ```
>>
>> [0] https://jsonlint.com/
>
> I don't see an unescape function in phobos and below doesn't
> seem to work
>
> string msg2 =
> parseJSON(msg)["markdown"].to!string.replace("\n", " ");
I used replace("\\n", "\n")
More information about the Digitalmars-d-learn
mailing list