takhand / Project_IoT

Building Infrastructure for IoT
0 stars 0 forks source link

parsing Json in Python #2

Open takhand opened 11 years ago

takhand commented 11 years ago

sep = json.dumps(data1, separators=(',',':'))

make sure to use the separator function when parsing JSON pacekts.

osman-abdillahi commented 11 years ago

U do not need sperators in JSON, hence JSON

Date: Thu, 6 Jun 2013 17:26:07 -0700 From: notifications@github.com To: Project_IoT@noreply.github.com CC: osman37@live.ca Subject: [Project_IoT] parsing Json in Python (#2)

sep = json.dumps(data1, separators=(',',':'))

make sure to use the separator function when parsing JSON pacekts.

— Reply to this email directly or view it on GitHub.

osman-abdillahi commented 11 years ago

Im preety sure i mentioned this a few times already. Just think abt it.

From: osman37@live.ca To: reply@reply.github.com Subject: RE: [Project_IoT] parsing Json in Python (#2) Date: Thu, 6 Jun 2013 21:25:43 -0400

U do not need sperators in JSON, hence JSON

Date: Thu, 6 Jun 2013 17:26:07 -0700 From: notifications@github.com To: Project_IoT@noreply.github.com CC: osman37@live.ca Subject: [Project_IoT] parsing Json in Python (#2)

sep = json.dumps(data1, separators=(',',':'))

make sure to use the separator function when parsing JSON pacekts.

— Reply to this email directly or view it on GitHub.

takhand commented 11 years ago

I kno you don't need to but its better. Its more efficient, It takes away the unnecessary white space in the JSON parsing.

osman-abdillahi commented 11 years ago

http://stackoverflow.com/questions/4150621/are-whitespace-characters-significant-in-json

Date: Thu, 6 Jun 2013 18:36:04 -0700 From: notifications@github.com To: Project_IoT@noreply.github.com CC: osman37@live.ca Subject: Re: [Project_IoT] parsing Json in Python (#2)

I kno you don't need to but its better. Its more efficient, It takes away the unnecessary white space in the JSON parsing.

— Reply to this email directly or view it on GitHub.

takhand commented 11 years ago

Ah ok. Well whenever i parse JSON i use the saparator because the XBee is reading the whitespace unecessarily. Example Without seperator a = {'type': "smart searting", 'destination': 002, 'kobe':[222,343,55]} wth separator a = {'type':"smart seating",'destination':002,'kobe:[222,343,555]}

But yeah It doesn't matter, i was trying to make things easier for the XBee to handle. we can stick with the one without the separator, it will be more expandable.