Is there a better way to write strings that contain quotes?

I’m having some issues managing this api body request. Is there a better way to write big strings into assings? I dont want to use a text file for this since i have some variables that change depending on earlier API calls.

The error im getting is

Elements oppretta journalpost: 2023/219. response: {"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"4000440a-0001-df00-b63f-84710c7967bb","errors":{"$.dokumentTypeId":["'I' is an invalid start of a value. Path: $.dokumentTypeId | LineNumber: 0 | BytePositionInLine: 191."]}}

Hi,

I think it may be better to use JObject as the following.

Or if you want to use string-manipulation, String.Format will help you.

Regards,

1 Like

Thanks a lot! The JObject will fit me best i think. But how would you do it with an array inside the jobject? Like this?
image
I tried this but it gave an error:
image

Assign jObject OppdaterSak: Can not add Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JArray.```

Hi,

Can you try to use JObject as the following?

Regards,

1 Like

Yep, that works! Thank you so much!

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