On Dec 18, 2013, at 13:37, Julien Wajsberg <[email protected]> wrote: > Le 18/12/2013 15:39, [email protected] a écrit : >> Hello all, >> >> I'm currently working on a FFOS app & web service to back up all contacts. >> I'd like to export all mozContact items as JSON and import them the same >> way. Is there any build-in (undocumented) function to achieve this or do I >> have to write my own contactsToJSON / contactsFromJSON? >> > All you can use is documented in the WebIDL [1]. If it's not there it's > not there ;)
Note that WebIDL mozContact hasn't shipped. > That said, JSON.stringify(contact) works well IIRC. Sadly, it doesn't, for a couple of reasons. You'll have to roll your own function that transplants properties to a plain old JS object and then stringifies *that*. On 1.3 JSON.stringify should work, with the exception that photos will be lost. You have to write your own stringifier visitor to convert Blobs to base64 strings or something similar. -- reuben _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
