title: ijson.common.IncompleteJSONError: lexical error: invalid char in json text
body: <p><em>hi all ijson newbie I have a very large .json file 168 (GB) I want to get all possible keys, but in the file some values are written as NaN. ijson creates a generator and outputs dictionaries, in My code value. When a specific item is returned, it throws an error. How can you get a string instead of a dictionary instead of value? Tried</em> **parser = ijson.items (input_file, '', multiple_values = True, map_type = str) **, <em>didn't help.</em></p>
  <pre><code>def parse_json(json_filename):
      with open('max_data_error.txt', 'w') as outfile:
          with open(json_filename, 'r') as input_file:'''
  
  
              # outfile.write('[ '
              parser = ijson.items(input_file, '', multiple_values=True)
              cont = 0
              max_keys_list = list()
              for value in parser:
                  for i in json.loads(json.dumps(value, ensure_ascii=False, default=str)) :
                      if i not in max_keys_list:
                          max_keys_list.append(i)
                          print(value)
                          print(max_keys_list)
  
              for keys_item in max_keys_list:
                  outfile.write(keys_item + '\n')
  
  
  if __name__ == '__main__':
      parse_json('./email/emailrecords.bson.json')
  </code></pre>
  <pre><code>Traceback (most recent call last):
    File &quot;panda read.py&quot;, line 29, in &lt;module&gt;
      parse_json('./email/emailrecords.bson.json')
    File &quot;panda read.py&quot;, line 17, in parse_json
      for value in parser:
  ijson.common.IncompleteJSONError: lexical error: invalid char in json text.
            litecashwire.com&quot;,&quot;lastname&quot;:NaN,&quot;firstname&quot;:&quot;Mia&quot;,&quot;zip&quot;:&quot;87
                       (right here) ------^
  </code></pre>