The JSON sent by Firebase is invalid
<pre><code>{ name: 'anonymous', text: 'Hello' }
{ name: 'anonymous', text: 'How are you' }
{ name: 'anonymous', text: 'I am fine' }
</code></pre>

<p>This code is returned by Firebase and I'm getting the error <code>No JSON object could be decoded</code>. I think this has to do something with the validity of the JSON format.</p>

<p>I'm getting this JSON data using the Firebase Node.JS SDK. Then I'm passing it to Python using Pyshell. When I use the <code>json.loads</code> in python, tt says:</p>

<pre><code>C:\Python27&gt;node firebase2.js
{ name: 'anonymous', text: 'Hello' }
{ name: 'anonymous', text: 'How are you' }
{ name: 'anonymous', text: 'I am fine' }
C:\Python27\firebase2.js:40
          if (err) throw err;
                   ^

Error: ValueError: No JSON object could be decoded
    at PythonShell.parseError (C:\Python27\node_modules\python-shell\index.js:183:17)
    at terminateIfNeeded (C:\Python27\node_modules\python-shell\index.js:98:28)
    at ChildProcess.&lt;anonymous&gt; (C:\Python27\node_modules\python-shell\index.js:88:9)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
    ----- Python Traceback -----
    File "my_script.py", line 3, in &lt;module&gt;
      myjson = json.loads(myinput)
    File "C:\Python27\lib\json\__init__.py", line 339, in loads
      return _default_decoder.decode(s)
    File "C:\Python27\lib\json\decoder.py", line 364, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
      raise ValueError("No JSON object could be decoded")
</code></pre>

<p>I got my error after some debugging.</p>

<pre><code>ref.on("child_added", function(snapshot, prevChildKey) {
  var newPost = snapshot.val();
  newPost = JSON.stringify(newPost);      //this line corrected my error
  });
</code></pre>

<p>The following line removed the error:</p>

<pre><code>newPost = JSON.stringify(newPost);
</code></pre>

<p><br>By the way, thanks everyone for guiding me.</p>

python json node.js firebase firebase-cloud-messaging