Opened 12 years ago

Closed 12 years ago

#17739 closed Bug (invalid)

Error encountered when fixtures only has one fixture

Reported by: shivrajpersaud@… Owned by: nobody
Component: Core (Serialization) Version: 1.3
Severity: Normal Keywords: models fixtures
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

initial_data.json

[
{

"model":"faves.favetype",
"pk":4,
"fields":{

"slug":"addresses",
"name":"favorite addresses"

}

},
]

Problem was fixed when fixture was added to initial_data.json with more than one fixture.

/ ERROR --------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Problem installing fixture '/home/spersaud/buymerentme/projects/address/fixtures/initial_data.json': Traceback (most recent call last):

File "/home/spersaud/my_new_env/lib/python2.6/site-packages/django/core/management/commands/loaddata.py", line 169, in handle

for obj in objects:

File "/home/spersaud/my_new_env/lib/python2.6/site-packages/django/core/serializers/json.py", line 35, in Deserializer

for obj in PythonDeserializer(simplejson.load(stream), options):

File "/usr/lib/python2.6/json/init.py", line 267, in load

parse_constant=parse_constant, kw)

File "/usr/lib/python2.6/json/init.py", line 307, in loads

return _default_decoder.decode(s)

File "/usr/lib/python2.6/json/decoder.py", line 319, in decode

obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "/usr/lib/python2.6/json/decoder.py", line 336, in raw_decode

obj, end = self._scanner.iterscan(s, kw).next()

File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan

rval, next_pos = action(m, context)

File "/usr/lib/python2.6/json/decoder.py", line 219, in JSONArray

raise ValueError(errmsg("Expecting object", s, end))

ValueError: Expecting object: line 10 column 1 (char 150)

Change History (1)

comment:1 by Carl Meyer, 12 years ago

Resolution: invalid
Status: newclosed

The provided JSON has a trailing comma in the length-1 list of objects. JSON does not permit trailing commas, thus the error.

Note: See TracTickets for help on using tickets.
Back to Top