0
Array
(
[0] => Array
    (
        [lead_id] => 1
        [employee_id] => 2
        [update_date] => 2016-11-25
        [lead_status] => Fresh Leads
        [reason] => Deal Won
        [notes] => Array
            (
                [0] => Array
                    (
                        [notes] => Notes 1
                    )

                [1] => Array
                    (
                        [notes] => Notes 2
                    )

                [2] => Array
                    (
                        [notes] => Notes 3
                    )

            )

    )

[1] => Array
    (
        [lead_id] => 1
        [employee_id] => 5
        [update_date] => 2016-11-25
        [lead_status] => Fresh Leads
        [reason] => Deal Won
        [notes] => Array
            (
                [0] => Array
                    (
                        [notes] => Notes 1
                    )

                [1] => Array
                    (
                        [notes] => Notes 2
                    )

                [2] => Array
                    (
                        [notes] => Notes 3
                    )

            )

    )

[2] => Array
    (
        [lead_id] => 3
        [employee_id] => 2
        [update_date] => 2016-11-25
        [lead_status] => Fresh Leads
        [reason] => Deal Won
        [notes] => Array
            (
                [0] => Array
                    (
                        [notes] => Notes 1
                    )

                [1] => Array
                    (
                        [notes] => Notes 2
                    )

                [2] => Array
                    (
                        [notes] => Notes 3
                    )

            )

    )

)

This is my json array.
How can I get the values of each fields from this array?
Please help

4
  • 4
    This is not JSON. Commented Nov 25, 2016 at 6:45
  • 3
    Possible duplicate of Accessing JSON array after json_decode/multidimensional array Commented Nov 25, 2016 at 6:46
  • 2
    this is php array. foreach ($arr as $ar){echo $ar['lead_id']; // and so on for others} Commented Nov 25, 2016 at 6:46
  • Ramya this is an array not JSON object Commented Nov 25, 2016 at 6:46

1 Answer 1

0

This is not valid json array, you can validate your json arrays or json objects using following url

this the simple code of read json object using php

$data = '{
    "name": "Saman",
    "age": "19",
         "records":[{
                "subject1":"Maths",
                "marks":"67"

            }]
        }';

$character = json_decode($data);
echo "Name :".$character->name;
echo "Age :".$character->age; 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.