Opened 17 years ago

Closed 17 years ago

#4026 closed (worksforme)

Tyring to load a JSON dump fails with "Expecting property name"

Reported by: tyson@… Owned by: Jacob
Component: Core (Serialization) Version: dev
Severity: Keywords: json loaddata dumpdata fixtures
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I started with a fresh database with the following model:

/myproject/apps/databases/models.py

class Subject(models.Model):
	"""An academic subject area (Agriculture, Math, etc.)"""
	title = models.CharField(maxlength=100)
	slug = models.SlugField(prepopulate_from=("title",), unique=True)

In the admin interface, I added three dummy Subject objects.

In the terminal, I ran the following:

$ python manage.py dumpdata databases > subjects.json

I placed it in my app's "fixtures" directory and ran the following:

$ python manage.py loaddata subjects.json

Which gave me:

Loading 'subjects' fixtures...
Installing json fixture 'subjects' from '/Users/ttate/Desktop/myproject/../myproject/apps/databases/fixtures'.
Problem installing fixture '/Users/ttate/Desktop/myproject/../myproject/apps/databases/fixtures/subjects.json': Expecting property name: line 2 column 1 (char 3)

Here's the exported JSON that I got from the dump:

[{"pk": "3", "model": "databases.subject", "fields": {"slug": "boom", "title": "Boom"}}, {"pk": "2", "model": "databases.subject", "fields": {"slug": "more-testing", "title": "More Testing"}}, {"pk": "1", "model": "databases.subject", "fields": {"slug": "test", "title": "Test"}}]

Change History (2)

comment:1 by Tyson Tate <tyson@…>, 17 years ago

I forgot to add: I'm using SQLite and Python 2.4.

comment:2 by tyson Tate <tyson@…>, 17 years ago

Resolution: worksforme
Status: newclosed

I am now unable to reproduce this error, leading me to believe it may have been an odd file-corruption error of some sort. I'll reopen this ticket if it ever happens again (and I can reproduce it...)

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