Discussion:
Reading serialized data without json
Joel Mathew
2018-11-05 11:15:45 UTC
Permalink
Is it possible to read serialized data from javascript without encoding to json?

The data received by request.POST is:

<QueryDict: {'allergies[0][subst]': ['nsaid'], 'allergies[0][date]':
[''], 'allergies[1][subst]': ['alcohol'], 'allergies[1][date]': ['']}>

Sincerely yours,

Joel G Mathew
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw_9FW8QshYa9_K3rYMc%2BMF5vigZC3KdBFExvdH%2Bqves6ZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
oon arfiandwi
2018-11-05 18:34:20 UTC
Permalink
Hi,

have to try to convert the QueryDict to dictionary?
then try to get the keys as list.
Post by Joel Mathew
qdict
<QueryDict: {u'allergies[0][date]': [['']], u'allergies[1][subst]':
[['alcohol']], u'allergies[0][subst]': [['nsaid']], u'allergies[1][date]':
[['']]}>
Post by Joel Mathew
qdict.dict()
{u'allergies[0][date]': [''], u'allergies[1][date]': [''],
u'allergies[0][subst]': ['nsaid'], u'allergies[1][subst]': ['alcohol']}
Post by Joel Mathew
qdict.dict().keys()
[u'allergies[0][date]', u'allergies[1][date]', u'allergies[0][subst]',
u'allergies[1][subst]']
still need some work to detect the list index and further keys, but now you
can compare which way is easier to parse manually or serialize via json.
--
sincerely,
O
Post by Joel Mathew
Is it possible to read serialized data from javascript without encoding to json?
[''], 'allergies[1][subst]': ['alcohol'], 'allergies[1][date]': ['']}>
Sincerely yours,
Joel G Mathew
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAA%3Diw_9FW8QshYa9_K3rYMc%2BMF5vigZC3KdBFExvdH%2Bqves6ZA%40mail.gmail.com
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACUNLpXqAzZr2u16VTdFVBAmDbha60PZMXY%3DEwGo17bgHBQrfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...