- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Converting JSONL to Array with PHP
The json_decode function can be used as shown below −
json_decode($json_string_that_needs_to_be_converted, true);
The below lines of code can be used to convert JSONL to array format −
$json_string = '["m@gmail.com","p@gmail.com","q@gmail.com"]'; $array_of_data=json_decode($json_string);
An alternate is to use the below code, wherein the way json_string has been defined changes −
Example
$json_string = "[\"m@gmail.com\",\"p@gmail.com\",\"q@gmail.com\"]"; $array_of_data=json_decode($json_string);
Output
This will produce the following output −
Array("m@gmail.com","p@gmail.com","q@gmail.com")
Advertisements