Convert byte[] to JSONObject java
<p>I've seen many links here on SO and other places with similar issues but none was of help.</p>

<p>Here is my code:</p>

<pre><code>import java.util.Queue;
import java.util.LinkedList;

import javax.xml.bind.DatatypeConverter;

import org.json.simple.JSONObject;

import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;


public class ConsumerThread implements Runnable {

    private KafkaStream&lt;byte[], byte[]&gt; stream;

    public static Queue&lt;JSONObject&gt; message = (Queue&lt;JSONObject&gt;) new LinkedList&lt;JSONObject&gt;();

    public ConsumerThread(KafkaStream&lt;byte[], byte[]&gt; stream){
        this.stream = stream;
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub
        ConsumerIterator&lt;byte[], byte[]&gt; it = stream.iterator();
        while (it.hasNext()){
            byte[] msg = it.next().message();
            System.out.println(new String(msg));
            message.add(DatatypeConverter.printBase64Binary(msg));
        }
    }

}
</code></pre>

<p>This is giving error on the last line:</p>

<pre><code>message.add
</code></pre>

<p>I just want to convert this <code>byte[]</code> to <code>JSONObject</code> that can be pushed to Queue and I'm not sure what is the issue.</p>