๐ŸŒ
PHP
php.net โ€บ manual โ€บ en โ€บ function.json-decode.php
PHP: json_decode - Manual
The introduction of BigInt to modern browsers doesn't help much, when JSON handling functions do not support it. So I am trying to remedy that. My approach is to handle the decoded array before re-encoding it to a string: <?php function fix_large_int(&$value) { if (is_int($value) && $value > 9007199254740991) $value = strval($value); } $json_str = '{"id":[1234567890123456789,12345678901234567890]}'; $json_arr = json_decode($json_str, flags: JSON_BIGINT_AS_STRING | JSON_OBJECT_AS_ARRAY); echo(json_encode($json_arr)); // {"id":[1234567890123456789,"12345678901234567890"]} (BigInt is already converted to a string here) array_walk_recursive($json_arr, 'fix_large_int'); echo(json_encode($json_arr)); // {"id":["1234567890123456789","12345678901234567890"]} ?>
๐ŸŒ
ReqBin
reqbin.com โ€บ code โ€บ php โ€บ ozcpn0mv โ€บ php-parse-json-example
How do I parse JSON string in PHP?
To parse a JSON string to a PHP object or array, you can use the json_decode($json) function. The json_decode() function recursively converts the passed JSON string into the corresponding PHP objects.
๐ŸŒ
Envato Tuts+
code.tutsplus.com โ€บ home โ€บ cloud & hosting
How to Parse JSON in PHP | Envato Tuts+
May 31, 2021 - First, you need to get the data from the file into a variable by using file_get_contents(). Once the data is in a string, you can call the json_decode() function to extract information from the string.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_json_php.asp
JSON PHP
Convert the object into a JSON string. Send a request to the PHP file, with the JSON string as a parameter.
๐ŸŒ
CodeSignal
codesignal.com โ€บ learn โ€บ courses โ€บ handling-json-files-with-php โ€บ lessons โ€บ parsing-and-accessing-json-data-with-php
Parsing and Accessing JSON Data with PHP
Use file_get_contents to read the JSON file into a string. Decode the data using json_decode() to convert it into a PHP associative array. ... To access specific data from the parsed JSON, such as the school name, you navigate the hierarchical structure using keys:
๐ŸŒ
PHPpot
phppot.com โ€บ php โ€บ json-handling-with-php-how-to-encode-write-parse-decode-and-convert
JSON Handling with PHP: How to Encode, Write, Parse, Decode and Convert - PHPpot
The json_encode and json_decode PHP functions perform the encode and decode operations, respectively. The following code block shows the syntax of the json_decode function. This function accepts JSON string ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ php โ€บ how-to-parse-a-json-file-in-php
How to parse a JSON File in PHP? - GeeksforGeeks
In PHP, we use the file_get_contents() function to read the content of the JSON file. This function takes one parameter, which is the file path, and returns the content of the file as a string.
Published ย  June 24, 2025
๐ŸŒ
Tutorial Republic
tutorialrepublic.com โ€บ php-tutorial โ€บ php-json-parsing.php
How to Encode and Decode JSON Data in PHP - Tutorial Republic
Decoding JSON data is as simple as encoding it. You can use the PHP json_decode() function to convert the JSON encoded string into appropriate PHP data type.
๐ŸŒ
W3Docs
w3docs.com โ€บ php
How to Create and Parse JSON Data with PHP
<?php // An indexed array $colors ... a non-associative one- both as an object and an array. For parsing a JSON data you can use decoding. It is as simple as encoding. It is mainly applied for converting a JSON encoded string into ...
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ php โ€บ func_json_decode.asp
PHP json_decode() Function
affected_rows autocommit change_user character_set_name close commit connect connect_errno connect_error data_seek debug dump_debug_info errno error error_list fetch_all fetch_array fetch_assoc fetch_field fetch_field_direct fetch_fields fetch_lengths fetch_object fetch_row field_count field_seek get_charset get_client_info get_client_stats get_client_version get_connection_stats get_host_info get_proto_info get_server_info get_server_version info init insert_id kill more_results multi_query next_result options ping poll prepare query real_connect real_escape_string real_query reap_async_query refresh rollback select_db set_charset set_local_infile_handler sqlstate ssl_set stat stmt_init thread_id thread_safe use_result warning_count PHP Network
๐ŸŒ
Nidup
nidup.io โ€บ blog โ€บ manipulate-json-files-in-php
Read, Decode, Encode, Write JSON in PHP | Nicolas Dupont
March 12, 2022 - We use json_decode to convert (decode) the string to a PHP associative array.
๐ŸŒ
SitePoint
sitepoint.com โ€บ php
Encoding/Decoding JSON PHP - PHP - SitePoint Forums | Web Development & Design Community
February 19, 2023 - I can do this with Javascript, so needing to be schooled in PHP on how to do this. Please help. ... Just replace the backslash double quotes by double quotes and decode it. $data = json_decode(str_replace(โ€˜\"โ€™, โ€˜"โ€™, $source));
๐ŸŒ
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
PHP >= 5.2.0 features a function, json_decode, that decodes a JSON string into a PHP variable. By default it returns an object. The second parameter accepts a boolean that when set as true, tells it to return the objects as associative arrays.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ php-tutorial โ€บ json with php
JSON with PHP - Scaler Topics
March 31, 2024 - To parse JSON data in PHP without knowing the keys beforehand, you can use the json_decode() function in combination with loops and conditional statements. Here's a step-by-step guide: Get the JSON data: Retrieve the JSON data from a source, ...
๐ŸŒ
W3Schools
w3schools.com โ€บ php โ€บ php_json.asp
PHP and JSON
Since the JSON format is a text-based format, it can easily be sent to and from a server, and used as a data format by any programming language. PHP has some built-in functions to handle JSON.
๐ŸŒ
GitHub
github.com โ€บ halaxa โ€บ json-machine
GitHub - halaxa/json-machine: Efficient, easy-to-use, and fast PHP JSON stream parser ยท GitHub
Parsing a json array instead of a json object follows the same logic. The key in a foreach will be a numeric index of an item. If you prefer JSON Machine to return arrays instead of objects, use new ExtJsonDecoder(true) as a decoder. <?php use JsonMachine\JsonDecoder\ExtJsonDecoder; use JsonMachine\Items; $objects = Items::fromFile('path/to.json', ['decoder' => new ExtJsonDecoder(true)]);
Author ย  halaxa