Re: Stripping a JSON of extra characters in PHP

Ben Bacarisse <[email protected]> Sat, 04 Feb 2023 23:44:51 +0000
Newsgroups comp.lang.php
Organization A noiseless patient Spider
Message-ID <[email protected]>
"J.O. Aho" <[email protected]> writes:

> On 01/02/2023 17:09, Ben Bacarisse wrote:
>> [email protected] (The Doctor) writes:
>> 
>>>  From https://developer.moneris.com/livedemo/checkout/preload_req/guide/dotnet
>>>
>>> I need a JSON as follows:
>>>
>>> {
>>> 	"store_id":"moneris",
>>> 	"api_token":"hurgle",
>> What you pasted as what you "need" is not even valid JSON and has a huge
>> number of pointless spaces in it making it almost unreadable (in my news
>> client). I don't know what it is you mean.
>
> As I saw it, the OP post was more about the formatting of the json
> that is generated than about if his json was correct or not, he wants
> a multi line json with indentations instead of a single line
> compressed json.

Weird.  I didn't interpret a desire to "strip unnecessary punctuation"
as a formatting question, but I suppose it could be: unnecessary for
display even though necessary for valid syntax.

-- 
Ben.