Is this what you want?

echo json_encode($artists)

PHP: json_encode

Answer from Nikola Drosakis on Stack Overflow
🌐
PHP
php.net › manual › en › function.json-encode.php
PHP: json_encode - Manual
Returns a JSON encoded string on success or false on failure. ... <?php $a = array('<foo>',"'bar'",'"baz"','&blong&', "\xc3\xa9"); echo "Normal: ", json_encode($a), "\n"; echo "Tags: ", json_encode($a, JSON_HEX_TAG), "\n"; echo "Apos: ", json_encode($a, JSON_HEX_APOS), "\n"; echo "Quot: ", json_encode($a, JSON_HEX_QUOT), "\n"; echo "Amp: ", json_encode($a, JSON_HEX_AMP), "\n"; echo "Unicode: ", json_encode($a, JSON_UNESCAPED_UNICODE), "\n"; echo "All: ", json_encode($a, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE), "\n\n"; $b = array(); echo "Empty arra
🌐
W3Schools
w3schools.com › js › js_json_php.asp
JSON PHP
Before you send the request to the server, convert the JSON object into a string and send it as a parameter to the url of the PHP page: Use JSON.stringify() to convert the JavaScript object into JSON:
🌐
Jonathan Suh
jonsuh.com › blog › convert-loop-through-json-php-javascript-arrays-objects
Convert and Loop through JSON with PHP and JavaScript Arrays/Objects — Jonathan Suh
Like JSON.parse, JSON.stringify ... JSON.stringify as well. You can combine the methods above to create powerful, dynamic implementations on your website or application. Let’s say you want to get information from a database, safely return the data as JSON, and loop through it dynamically, you can do so with a bit of PHP and JavaScript ...
Find elsewhere
🌐
ReqBin
reqbin.com › code › php › 0uwqq41y › json-to-array-php-example
How do I convert JSON to PHP array?
To convert a JSON data string to a PHP array, you can use the json_decode($json) function. The json_decode() function accepts the JSON string as the first parameter and a few additional parameters to control the process of converting JSON to ...
🌐
W3Schools
w3schools.com › js › js_json_stringify.asp
JSON.stringify()
JSON.stringify() can not only convert objects and arrays into JSON strings, it can convert any JavaScript value into a string.
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-convert-a-string-to-json-object-in-php
How to Convert a String to JSON Object in PHP ? - GeeksforGeeks
July 23, 2025 - This approach involves using the explode() function to split a string into an array based on a delimiter and then converting that array into an associative array before using json_encode() to create the JSON object.
🌐
YouTube
youtube.com › watch
Mastering How to Stringify an Array and Convert to JSON in PHP - YouTube
Explore efficient techniques to convert PHP arrays to JSON strings and decode JSON strings back to PHP arrays. Simplify your data handling in web application...
Published   August 26, 2024
Views   1
🌐
Online Tools
onlinetools.com › json › stringify-json
Stringify JSON – Online JSON Tools
Simple, free, and easy-to-use online tool that stringifies JSON. Just upload your JSON here and you'll instantly get a stringified JSON.
🌐
Alessio Puppi's Blog
alessiopuppi.blog › home › home › json › json in javascript & php: parse and stringify json
JSON in JavaScript & PHP: Parse and Stringify JSON
May 26, 2024 - Learn how to efficiently parse and stringify JSON in JavaScript & PHP. Understand built-in functions, use cases, and best practices for web development.
🌐
4D
developer.4d.com › 4d language › commands by theme › json › json stringify
JSON Stringify | 4D Docs
var $MyContact : Text var $MyPContact : Text var $Contact;$Children : Object OB SET($Contact;"lastname";"Monroe";"firstname";"Alan") OB SET($Children;"firstname";"Jim";"age";"12") OB SET($Contact;"children";$Children) $MyContact:=JSON Stringify($Contact) $MyPContact:=JSON Stringify($Contact;*) //$MyContact= {"lastname":"Monroe","firstname":"Alan","children":{"firstname":"John","age":"12"}} //$MyPContact= {\n\t"lastname": "Monroe",\n\t"firstname": "Alan",\n\t"children": {\n\t\t"firstname": "John",\n\t\t"age": "12"\n\t}\n}