Click here to Skip to main content
14,773,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am new in json i have get the following json string from my app now i want to parse it in php but this syntax (logjson=) in json file is confused me that now how i can the display it?

What I have tried:

 {$someArray = json_decode(file_get_contents('php://input'), true);


it show me only empty text file .
Updated 27-Mar-20 3:36am

1 solution

You're trying to decode the entire request body, rather than the specific JSON field. Try:
if (isset($_POST['logjson']))
    $someArray = json_decode($_POST['logjson']);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900