1. #1
    Ext User mviens's Avatar
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    mviens is on a distinguished road

      0  

    Default JSON issue when name contains a period

    I have been having an issue getting my data to load into a store. After doing a side-by-side comparison of my data versus the sample data, the only difference I saw was the names of the data fields for mine contains a period. So, I tried a simple test:

    This works -
    Code:
    {"totalCount":2,"users":[{"userid":"admin"}, {"userid":"corp"}]}
    This works -
    Code:
    {"totalCount":2,"users":[{"user_id":"admin"}, {"user_id":"corp"}]}
    This does not work -
    Code:
    {"totalCount":2,"users":[{"user.id":"admin"}, {"user.id":"corp"}]}
    Is this an issue with the JSON implementation in Ext? I have read the JSON spec located at http://www.ietf.org/rfc/rfc4627.txt?number=4627, but I did not see any restriction that states the data field names must not contain a period.

    Other characters, like the underscore, do work. Not only would it be very time-consuming to change the names for each element that may be transferred, but it is error prone and would break our back-end API as well.

    After searching the forum, I found this information:

    This has some examples of using a mapping attribute that contains a period. Not sure if this is in anyway related or not.
    http://extjs.com/forum/showthread.php?t=4537

    This contains an example of creating a Record with names containing a dot.
    http://extjs.com/forum/showthread.php?t=17021&page=2

    Does anyone have a solution and/or work-around for this issue?

    Mike V.

  2. #2
    Sencha - Services Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,965
    Vote Rating
    12
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default

    Periods in variable references (as in object.member) are enforced by Javascript itself. Sorry.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  3. #3
    Ext User
    Join Date
    Dec 2007
    Posts
    110
    Vote Rating
    0
    tunaboo is on a distinguished road

      0  

    Default

    I had a similar issue, but with spaces in names instead of periods. I just switched to XMLs

  4. #4
    Ext User mviens's Avatar
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    mviens is on a distinguished road

      0  

    Default

    Doug,

    While disappointing, thank you very much for your reply.

    Mike V.

Thread Participants: 2