I was playing around with lightning components, and I came across a weird situation.

Data binding for attribute type object doesn't work.

here is minimum viable code to reproduce this behavior.


    <aura:attribute type="Object" name="myObject" default="{'Name':'Dummy'}"></aura:attribute>

    <lightning:input type="text" label="Name" name="myName" value="{!v.myObject.Name}" />


Nothing fancy, I declared an attribute and using it in Lightning: input to check binding.(I tried with UI:InputText same issue).

According to this documentation there are issues with serialization when using attribute of type Object when doing server downtrip. As I am not doing any, it should be fine.


I can change the atrribute type to Map to make it work, I want to know if its the expected behaviour for attribute of type Object or am missing something silly.

Edit: So I tried removing the default and doing initialization in init event. Same behaviour.

  • Great question. Nice example of MVC. I've hit the same problem so your question (still unanswered) is saving me time. Thanks. I hope someone can say for sure if Object is supported. Another question came back with the same answer (to use Map). salesforce.stackexchange.com/questions/151673/…
    – Bryan
    Commented Jun 9, 2018 at 15:12

1 Answer 1


The only situation I've noticed the type attribute having an impact is in the parsing of the default value. Changing to Map or SObject will get your default parsed.

This value can't be relevant to basic JavaScript syntax by the very nature of JavaScript's weak typing. But when the .cmp is processed specific logic can be run. There may also be some type-specific logic inside the client-side Aura framework but I haven't noticed it.

  • Yeah.. changing to map works, I wanted to know if that's expected behaviour for attribute of type Object Commented Jun 7, 2018 at 10:21
  • @PranayJaiswal Makes sense to me that extra type information is needed to decide whether to just take the default value as a string or to parse it assuming JSON into an object.
    – Keith C
    Commented Jun 7, 2018 at 10:23
  • I removed the default attribute and wrote initialization on init event. Same, I cant make Object work. Commented Jun 7, 2018 at 10:30
  • @PranayJaiswal I think I've done that and remember it working. Must have been something different in what I was doing.
    – Keith C
    Commented Jun 7, 2018 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .