@@ -56,7 +56,7 @@ def createFieldsBinding(schemaObject, startPath=""):
5656 else :
5757 path = '{}{}{}' .format (
5858 startPath , options ["privateSeparator" ], oneElement )
59- if isinstance (schemaObject , dict ) and ( isinstance ( schemaObject [oneElement ], dict ) or isinstance (schemaObject [oneElement ], list ) ):
59+ if isinstance (schemaObject [oneElement ], dict ) or isinstance (schemaObject [oneElement ], list ):
6060 if isinstance (schemaObject [oneElement ], list ):
6161 bindings .append ({
6262 "name" : oneElement ,
@@ -131,28 +131,41 @@ def parseLine(line):
131131 long = len (allPath )
132132 for count in range (0 , long ):
133133 nextPath = allPath [count ]
134+ if isinstance (goodPlace , list ):
135+ nextPathInt = int (nextPath )
134136 if count == (long - 1 ):
135137 if not isinstance (goodPlace , list ):
136138 goodPlace [nextPath ] = ""
137139 else :
138140 if nextPath not in goodPlace :
139- goodPlace [nextPath ] = {}
140- goodPlace = goodPlace [nextPath ]
141+ if isinstance (goodPlace , list ):
142+ goodPlace .insert (nextPathInt , {})
143+ else :
144+ goodPlace [nextPath ] = {}
145+ if isinstance (goodPlace , list ):
146+ goodPlace = goodPlace [nextPathInt ]
147+ else :
148+ goodPlace = goodPlace [nextPath ]
141149 if isinstance (goodPlace , list ):
142150 goodPlace .append (currentValue )
143151 elif isinstance (goodPlace , dict ):
144152 goodPlace [onePathName ] = currentValue
145153 else :
146154 goodPlace = currentValue
147155 else :
148- obj [onePathRow ] = currentValue
156+ if isinstance (obj , list ):
157+ place = int (onePathRow )
158+ obj .insert (place , currentValue )
159+ elif isinstance (obj , dict ):
160+ obj [onePathRow ] = currentValue
149161 return obj
150162
151163 def parsefirstLine ():
152164 global firstLine
153165 if isinstance (options ["overrideFirstLine" ], list ):
154166 firstLine = options ["overrideFirstLine" ]
155- if isinstance (schema , dict ):
167+ if schema != None :
168+ # None is default value for schema
156169 cols = createFieldsBinding (schema )
157170 if options ["debug" ]:
158171 print ("BINDINGS:" , JSONstringify (cols ))
0 commit comments