Z
Z
zedzew2015-03-28 19:43:50
JSON
zedzew, 2015-03-28 19:43:50

How to parse a Json file and add it to the database?

I have a json file, how to parse it and add it to the database?

Locally parse like this:

# -*- coding: utf-8 -*- 
import sys
import codecs
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
import json
s = open('C:\\Users\\...\\...\\2CuNPefD.json').read()
data = json.loads(s)
print json.dumps(data, ensure_ascii=False, indent=3)


A file inside a structure like this:
{
   "data": [
      {
         "Значение": "288.00", 
         "Область": "Область какая то", 
         "Город": "Город какой то"
      }, 
...
], 
   "structure": [
      "Область", 
      "Город", 
      "Значение"
   ]
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Seva Zhidkov, 2015-03-29
@Shamoi

What exactly needs to be added to the database?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question