Yes, you can. These two notations are exactly the same : a.b.c.d.e.f <=> a['b'].c['d']['e'].f
The array notation is very usefull when you have dynamic keys ( arr[dynamicKey]) or complex keys (arr['Hey dude !']) On Monday, March 10, 2014 3:59:53 PM UTC+1, Gaurav Dhiman wrote: > > Thanks Julien, it worked. > Can we refer deep level objects in this manner, using array notation [] in > place of dot notation ? > > Thanks for your help ! > > Regards, > Gaurav > > > > On Mon, Mar 10, 2014 at 8:06 PM, Julien L. <[email protected]<javascript:> > > wrote: > >> The dot notation is the shortcut of the array access. Just use >> *data.result[0]['@rid']* in this case. >> >> >> On Monday, March 10, 2014 2:33:06 PM UTC+1, Gaurav Dhiman wrote: >> >>> @Lvc, as suggested by you, when I use ['@rid'] >>> *alert(data.result[0].['@rid']);* >>> >>> Chrome debugger says "Uncaught SyntaxError: Unexpected string" >>> >>> Any other suggestions. I am sure many other OrientDB users must have >>> faced this basic thing while consuming OrientDB generated JSON in their app. >>> >>> Can not we configure OrientDB to use some other character in place of @ >>> and # while throwing out JSON to client ? >>> >>> >>> Regards, >>> Gaurav >>> >>> >>> >>> On Mon, Mar 10, 2014 at 4:42 PM, Luca Garulli <[email protected]>wrote: >>> >>>> Hi, >>>> Use ['@rid'] >>>> >>>> Lvc@ >>>> >>>> Sent from Mobile device >>>> Il 10/mar/2014 17:22 "Gaurav Dhiman" <[email protected]> ha scritto: >>>> >>>>> Issue - @ character is not a valid character in JavaScript >>>>> identifier (variable, function name etc), then how to refer @rid in >>>>> returned JSON from OrientDB ? >>>>> >>>>> Details: >>>>> >>>>> When I get the JSON response from OrientDB and I try to show the @rid, >>>>> @type etc in app, I get JS error >>>>> >>>>> In client http response function, below is the wrong syntax >>>>> function httpResponse (data, status) { >>>>> alert(data.result[0].@rid); // how to refer >>>>> @rid here ?? >>>>> } >>>>> >>>>> -- >>>>> >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "OrientDB" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "OrientDB" group. >>>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>>> topic/orient-database/cieTooNWJms/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "OrientDB" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/orient-database/cieTooNWJms/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
