Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
Clean previous data django

I have a JSONField in my model and I wasn't able to clean the initial import on my resource so the data imported were treated as strings instead of lists. When I export the data it looks like this:

enter image description here

The ones below are the previous data from the initial import-export without a custom JSONWidget. The ones above are the data that was cleaned.

How can I then fix the current JSONField with the string and convert it to a list?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Presumably you want to clean the values in the database, so that they are standardised to empty list. If so, there are a few ways you could do this:

  • A straight UPDATE command via SQL (example)
  • If you can run ./manage.py shell you should be able to filter the entries and correct the data.
  • If you can run django-admin commands, write a script which filters and corrects the data, then use the django-extensions runscript command.
  • Create a data migration

Please correct me if I have misunderstood what you are aiming to do.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!