Had the same problem

Let me show you what I did

PHP :

base64_encode(json_encode($bodyData))

then

json_decode(shell_exec('python ' . base64_encode(json_encode($bodyData)) );

and in Python I have

import base64

and

content = json.loads(base64.b64decode(sys.argv[1]))

as Em L already mentioned :)

It works for me Cheers!

Answer from bobkoo on Stack Overflow
๐ŸŒ
ReqBin
reqbin.com โ€บ code โ€บ php โ€บ 0kvtdskv โ€บ php-array-to-json-example
How do I convert PHP Array to JSON?
To convert a PHP array to JSON data string, you can use the json_encode($value, $flags, $depth) function. The json_encode() function takes a PHP array as input and returns a JSON string representation.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_json_php.asp
JSON PHP
Convert the request into an object, using the PHP function json_decode(). Access the database, and fill an array with the requested data. Add the array to an object, and return the object as JSON using the json_encode() function.
๐ŸŒ
W3Schools
w3schools.com โ€บ php โ€บ php_json.asp
PHP and JSON
PHP has some built-in functions to handle JSON. First, we will look at the following two functions: ... The json_encode() function is used to encode a value to JSON format. This example shows how to encode an associative array into a JSON object:
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_json.asp
Python JSON
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
Find elsewhere
๐ŸŒ
Swapcode
swapcode.ai โ€บ home โ€บ home โ€บ converters โ€บ php array to json
PHP Array to JSON Converter (Free AI Tool)
Each product associative array becomes JSON object within the array. Floats (999.99) and booleans preserve types. This handles legacy PHP codebases and WordPress plugins still using array() syntax while producing modern JSON for REST APIs compatible ...
๐ŸŒ
TheLinuxCode
thelinuxcode.com โ€บ home โ€บ how to encode an array in json with php (production-ready guide)
How to Encode an Array in JSON with PHP (Production-Ready Guide) โ€“ TheLinuxCode
1 month ago - Struggling with PHP Array to JSON Conversion? This Expert Guide has You Covered! Master Encoding Strings in Python with string.encode()
๐ŸŒ
PHP
php.net โ€บ manual โ€บ en โ€บ function.json-encode.php
PHP: json_encode - Manual
Returns a string containing the JSON representation of the supplied value. If the parameter is an array or object, it will be serialized recursively. If a value to be serialized is an object, then by default only publicly visible properties will be included.
๐ŸŒ
Jsontotable
jsontotable.org โ€บ php-to-json
PHP to JSON Converter - Serialize PHP with json_encode | PHP JSON Serializer | JSON to Table Converter
The converter supports PHP arrays (both array() and [] syntax), associative arrays, strings, numbers, booleans (true/false), and null. These are converted to their JSON equivalents: objects, arrays, strings, numbers, booleans, and null. Yes! The converter produces standard, valid JSON that can be used in any application or API. The output is properly formatted and validated. You can further validate the JSON or convert it to other formats like TypeScript or Python.
๐ŸŒ
ReqBin
reqbin.com โ€บ code โ€บ php โ€บ 4qfsaffq โ€บ php-json-encode-example
How do I encode a PHP object to JSON string?
JSON is widely used for data exchange ... extension. To convert a PHP array or object to a JSON representation, you can use the json_encode() function:...
๐ŸŒ
ReqBin
reqbin.com โ€บ code โ€บ php โ€บ 0uwqq41y โ€บ json-to-array-php-example
How do I convert JSON to PHP array?
PHP provides many built-in functions for manipulating arrays, including sorting, searching, checking if an element exists in an array, splitting string to array, converting array to string, converting array to JSON, and getting the length of an array. JSON (JavaScript Object Notation) is a language-independent text format for storing and exchanging data. JSON is widely used for web APIs, storing configuration data, exchanging data between web applications, and transmitting data between client and server in web applications. Many programming languages have built-in or external libraries for creating and manipulating JSON data strings, including JavaScript, Python, C++, C#, Go, PHP, and Java.
๐ŸŒ
W3Schools
w3schools.com โ€บ php โ€บ func_json_encode.asp
PHP json_encode() Function
Arrays Indexed Arrays Associative Arrays Create Arrays Access Array Items Update Array Items Add Array Items Remove Array Items Sorting Arrays Multidimensional Arrays Array Functions PHP Superglobals ยท Superglobals $GLOBALS $_SERVER $_REQUEST $_POST $_GET PHP RegEx PHP RegEx Functions ยท PHP Form Handling PHP Form Validation PHP Form Required PHP Form URL/E-mail PHP Form Complete ยท PHP Date and Time PHP Include PHP File Handling PHP File Open/Read PHP File Create/Write PHP File Upload PHP Cookies PHP Sessions PHP Filters PHP Filters Advanced PHP Callback Functions PHP JSON PHP Exceptions
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ php โ€บ how-to-create-an-array-for-json-using-php
How to create an array for JSON using PHP? - GeeksforGeeks
July 11, 2025 - These keys will be a string or an integer which will be used as an index to search the corresponding value in the array. The json_encode() function is used to convert the value of the array into JSON. This function is added in from PHP5.