Opened 8 years ago

Closed 8 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: master
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: UI/UX:

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 Changed 8 years ago by Tyson Tate <tyson@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 8 years ago by tyson Tate <tyson@…>

  • Resolution set to worksforme
  • Status changed from new to closed

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