0

I'm new to angularjs. I have a json.

{
    "first": {
        "content": {
            "admin.nv.example.com": {
                "start": "2016-02-24 06:04:12.772141"
            }
        }
    }
}

This is my JSON response i want to obtain value of property name (start) in this whole response but whenever i try to access this property value by first.content.admin.example.com.start

it shows error:Cannot read property 'nv' of undefined(angularjs)

1
  • var x=JSON.parse('{ "first": { "content": { "admin.nv.example.com": { "start": "2016-02-24 06:04:12.772141" } } }}'); x.first.content["admin.nv.example.com"].start Commented Feb 24, 2016 at 8:55

4 Answers 4

1

You should use a different syntax to access the dotted property name. In fact it is better to avoid names like 'admin.nv.example.com' containing dots.

This should work:

first.content['admin.example.com'].start

Sign up to request clarification or add additional context in comments.

Comments

1

use first.content['admin.nv.example.com']

Comments

0

You should use the ["admin.nv.example.com"] notation.

Comments

0

You should understand the proper way of writing JSON. But you should use like this:

test['first']['content']['admin.nv.example.com'];

JSON formats

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.