title: Saving data into solr with pysolr get rejected 'AttributeError: 'str' object has no attribute 'items''
body: <p>I'm using pysolr to save a list of classes into my local solr database, my problem is that when i encode my list of classes with jsonpickle, the query is rejected with this message, although if i print the json generated by josnpickle i get no problem saving the data into solr.</p>
  
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-2-3b6d9f42d0ec&gt; in &lt;module&gt;()
       27 json=str(jsonpickle.encode(coreData, unpicklable=False))
       28 print(json)
  ---&gt; 29 solr.add(json)
  
      C:\ProgramData\Anaconda3\lib\site-packages\pysolr.py in add(self, docs, boost, fieldUpdates, commit, softCommit, commitWithin, waitFlush, waitSearcher, overwrite, handler)
          878 
          879         for doc in docs:
      --&gt; 880             el = self._build_doc(doc, boost=boost, fieldUpdates=fieldUpdates)
          881             message.append(el)
          882 
  
      C:\ProgramData\Anaconda3\lib\site-packages\pysolr.py in _build_doc(self, doc, boost, fieldUpdates)
          798         doc_elem = ElementTree.Element('doc')
          799 
      --&gt; 800         for key, value in doc.items():
          801             if key == NESTED_DOC_KEY:
          802                 for child in value:
  
      AttributeError: 'str' object has no attribute 'items'
  </code></pre>
  
  <p>my code:</p>
  
  <pre><code>from solrq import Q
  import pysolr
  import jsonpickle
  from datetime import datetime, timedelta
  from Model import Twitter
  
  
  
  #conexion a solr
  solr = pysolr.Solr('http://localhost:8983/solr/twitter')
  
  #query
  query = Q(label="none")
  results = solr.search(query)
  
  
  print("Saw {0} result(s).".format(len(results)))
  
  #testing the query
  for result in results:
      print("--&gt;".format(result['content']))
  
  #creating a new class with data    
  twit = Twitter("000002","content text","some label")  
  #list of twitter classes
  coreData=[]
  
  coreData.append(twit)
  #encoding to json
  json=str(jsonpickle.encode(coreData, unpicklable=False))
  
  print(json)
  #saving to solr
  solr.add(json)
  </code></pre>
  
  <p>This is what prints after encoding the list of classes into json <code>[{"content": "content text", "id": "000002", "label": "some label"}]</code>
  as i said before if i substitute the json variable with this string the data is saved but i have no idea why, even if cast as a string like this <code>solr.add(str(json))</code> get the same error message.</p>