Re: Stripping a JSON of extra characters in PHP
[email protected] (The Doctor) Tue, 7 Feb 2023 00:57:36 -0000 (UTC)
| Newsgroups | comp.lang.php |
|---|---|
| Organization | NetKnow News |
| Message-ID | <[email protected]> |
In article <[email protected]>, Arno Welzel <[email protected]> wrote: >The Doctor, 2023-02-06 16:28: > >[...] >> The cart is being derived from a previous form being passed into PHP! > >[...] >> $arr=array( >> 'store_id' => "store3", >> 'api_token' => "yesguy", >> 'checkout_id' => "chktGLFZQtore3", >> 'txn_total' => $_POST['charge_total'], >> 'environment' => "qa", >> 'action' => "preload", >> 'cart' => array( >> (foreach ($_POST['quantity'] as $key => $value) { > >Well - this will result in an array in the JSON named "cart". > >> $cart['items'][] =array( > >And this will also become an array named "items" inside "cart". > >So if you don't want "cart" to be an array in the JSON, then don't >create it this way. > >Learn how to read JSON and that the "punctuation" are not just >characters but have a specific meaning. In this case you created an >array and the JSON will have an array as well - indicated by "[" and "]". > Again basing this on Moneris prereqs. >-- >Arno Welzel >https://arnowelzel.de > -- Member - Liberal International This is [email protected] Ici [email protected] Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising! Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b Extremism is for those who love judging, and care nothing for accuracy. -unknown Beware https://mindspring.com