JsonObject WriteFile

Andy Whitcombe

New Member
Hi,

Having a complete mind blank on something....

Started using Progress.Json.ObjectModel.*. earlier today...

Example as follows

Code

USING Progress.Json.ObjectModel.*.

DEFINE VARIABLE oJson AS JsonObject NO-UNDO.
DEFINE VARIABLE oData AS JsonObject NO-UNDO.

oJson = NEW JsonObject().

oData = NEW JsonObject().
oData:ADD("url","BBC - Home").
oJson:ADD("data", oData).
oJson:WriteFile("c:\temp\test2.json", TRUE,"UTF-8").

Output is

{
"data": {
"url": "http:\/\/www.bbc.co.uk\/"
}
}

I don't want the \ before each of the / in my file.

I have tried a number of different ways; I am sort of hoping someone will point out the really obvious flaw

Thanks
Andy
 
Last edited:

LarryD

Active Member
That is an escape character for the forward slash,, so you need to leave it. It is sometimes known as 'toothpick syndrome'

An explanation is here.
 

Andy Whitcombe

New Member
Thanks @LarryD

I had assumed as much, makes sense to do so.

My issue is the documentation set I am working with, shows the Request Body as a JSON containing an URL with no escapes; It could simply be an error in the doc set, or it could be that is what they want, hence trying to understand if I can achieve.

I can only clarify next Wednesday after the long bank holiday weekend and associated holidays...

With that in mind, I thought I would spend a short amount of time looking at both options.
 
Top