below is json format ,
please help me how to do in php using json_encode

    [
      {
        "test": "1",
        "ex": {
          "ex1": {},
          "ex2": {}
        }
      }
    ]

Recommended Answers

All 3 Replies

Can you be a bit clearer? Do you want that as output, or do you want to read it in PHP?

I want that as output

@ ramsiva i think this should help you.

$json = array(array("test" => 1,"ex"=>array("ex1"=>array("a"=>1),"ex2"=>array("b"=>2))));
echo json_encode($json);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.