Here you can find the source of hash2jsonBytes(Map
public static byte[] hash2jsonBytes(Map<String, Object> hash)
//package com.java2s; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; public class Main { public static byte[] hash2jsonBytes(Map<String, Object> hash) { String result = null;/*from w w w. ja v a 2 s.c o m*/ JSONObject json = new JSONObject(hash); try { result = json.toString(2); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result.getBytes(); } }