Skip to main content
January 12, 2013
Answered

Saving objects data to txt

  • January 12, 2013
  • 2 replies
  • 3059 views

Hi

I'm populating a datagGrid with external csv data, by loading it, converting it to an object, then loading into the data provider.

Would I be better off (and is it possible) to not use csv, but objects instead?

So have in a txt file...

{id:128, name:"Moi"},{id:156, name:"You"} // my actual objects have about 10 keys each

...load the txt file, split it at the commas into an array of objects, and use that as the dataprovider?

Or do you have to serialize from dataprovider -> objects -> csv (or xml), then csv -> objects -> dataprovider?

I have a feeling AS3 has a max string size it'll load, so maybe that would kill things.

Cheers for taking a look.

This topic has been closed for replies.
Correct answer kglad

you could use json or xml in your text file and directly assign the loaded string to your dp.

2 replies

sinious
Legend
January 12, 2013

Max string length should be very tolerably long, but consider any multi-byte characters and the ramping up of urlencoded values using up multiple characters. The string length I recall is 2^30 - 1 (or 1,073,741,823 bytes). I think you'd hit your network transfer timeout before transferring a string that big . Another vote for JSON here as well and your CSV is eerily already similar to it, like a faux JSON. 

January 13, 2013

Thanks you both.  I'll load the latest sdk so I can try the new JSON class.

kglad
Community Expert
Community Expert
January 13, 2013

you're welcome.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 12, 2013

you could use json or xml in your text file and directly assign the loaded string to your dp.