Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: Stripping a JSON of extra characters in PHP Date: Fri, 10 Feb 2023 11:49:57 +0100 Lines: 33 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net PJPp1xHWhagK/RV6BQqoEgiCfvATy/28HlK4/xTn3THFm01yXW Cancel-Lock: sha1:BQhvpKJF9vRys4KE6+V9iGPWaUw= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US-large In-Reply-To: Xref: csiph.com comp.lang.php:19319 On 2/9/23 22:01, The Doctor wrote: > In article , > Arno Welzel wrote: >> Sorry - but if you are really not able to understand what I write, you >> should pay someone to do the job for you. > > The problem is the way the supplier wants to oush the information. You need to follow the api requierment which says that the json should have an array of json objects, not an array of arrya with array. Your task is to take the posted value convert it to be in the format that the api requiers. Using classes will make the code more readable and you can break things up into smaller chunks when you are writing your code. I think it's beter to transform things into a variable and then assing it to the object's variable to make the assignment clear and simple. Don't forget that the classes can include arrays, but only use those in the places where you need it, IMHO it can be sometimes good to iniate the array in the class constructor (this only can be done as long as the api don't require the array to be omitted if no values). Don't forget that the company providing the API also has a support team which can help, sure it may come with a cost, depending on the deggree of help and how much they think is out of topic. For them it's importnat to earn money and if they think helpiing you will give them enough money in return, they may help more than they normal support is mandated to do. -- //Aho