2

I have the JS-object, that in Chrome's console looks as folllow:

data: Object
 comparisonType: "IN"
 dateValue: ""
 numericalValue: 0
 screeningCriterionId: "-4"
 screeningField.displayName: "Prop1"
 screeningField.fieldName: "Prop2"
 screeningField.groupName: "Prop3"
 screeningField.type: "MULTI"
 value: null

And I need to read the screeningField.displayName: "Prop1" from this object , but trying to execute in console this myObject.screeningField.displayName I'm getting the error:

TypeError: Cannot read property 'displayName' of undefined

How to solve my problem ?

6
  • 3
    If this is indeed what you see in your console, then apparently the dot is actually included in the key name: try myObject['screeningField.displayName'] Commented Dec 7, 2012 at 7:56
  • This does not look like JavaScript. What is your JavaScript code you use to initialize the object? @lanzz: incorrect, the error says screeningField is undefined. Commented Dec 7, 2012 at 7:56
  • @Cerbrus: of course it does, because it is. Commented Dec 7, 2012 at 8:00
  • Cerbrus, I'm getting this object from another code, which I can't watch to define how it initializes. Commented Dec 7, 2012 at 8:02
  • @lanzz, oh right, since screeningField doesn't exist, the only other option with that object structure would be that the dot is included in the key name? Commented Dec 7, 2012 at 8:04

1 Answer 1

5

Apparently the dot is actually included in the key name, try:

myObject['screeningField.displayName']
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.