title: How to merge two json string in Python?
body: <p>I recently started working with Python and I am trying to concatenate one of my JSON String with existing JSON String. I am also working with Zookeeper so I get the existing json string from zookeeper node as I am using Python kazoo library.</p>
  
  <pre><code># gets the data from zookeeper
  data, stat = zk.get(some_znode_path)
  jsonStringA = data.decode("utf-8")
  </code></pre>
  
  <p>if I print <code>jsonStringA</code> it gives me like this -</p>
  
  <pre><code>{"error_1395946244342":"valueA","error_1395952003":"valueB"}
  </code></pre>
  
  <p>But if I do <code>print json.loads(jsonString)</code> then it prints out like this -</p>
  
  <pre><code>{u'error_1395946244342': u'valueA', u'error_1395952003': u'valueB'}
  </code></pre>
  
  <p>Here <code>jsonStringA</code> will have my existing JSON String. Now I have another key-value pair which I need to add in the exiting <code>jsonStringA</code> -</p>
  
  <p>Below is my Python code -</p>
  
  <pre><code># gets the data from zookeeper
  data, stat = zk.get(some_znode_path)
  jsonStringA = data.decode("utf-8")
  
  timestamp_in_ms = "error_"+str(int(round(time.time() * 1000)))
  node = "/pp/tf/test/v1"
  a,b,c,d = node.split("/")[1:]
  host_info = "h1"
  local_dc = "dc3"
  step = "step2"
  </code></pre>
  
  <p>My existing <code>jsonStringA</code> will be like this after extracting from zookeeper -</p>
  
  <pre><code>{"error_1395946244342":"valueA","error_1395952003":"valueB"}
  </code></pre>
  
  <p>Now I need to append this key-value pair in the <code>jsonStringA</code> - </p>
  
  <pre><code>"timestamp_in_ms":"Error Occured on machine "+host_info+" in datacenter "+ local_dc +" on the "+ step +" of process "+ c +"
  </code></pre>
  
  <p>So in short I need to merge below key-value pair -</p>
  
  <pre><code>"error_1395952167":"Error Occured on machine h1 in datacenter dc3 on the step2 of process test"
  </code></pre>
  
  <p>So final JSON String will look like this -</p>
  
  <pre><code>{"error_1395946244342":"valueA","error_1395952003":"valueB","error_1395952167":"Error Occured on machine h1 in datacenter dc3 on the step2 of process test"}
  </code></pre>
  
  <p>Is this possible to do?</p>