package com.example.ismailamrani.comptable.utils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Mohammed Aouf ZOUAG on 04/05/2016.
 */
public class JSONUtils {
    /**
     * Assembles the passed-in JSONArray into a JSONObject, using the @tag argument.
     * @param array
     * @param tag
     * @return JSONObject
     */
    public static JSONObject bundleWithTag(JSONArray array, String tag) {
        JSONObject data = new JSONObject();
        try {
            data.put(tag, array);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return data;
    }
}

@@ -624,16 +624,386 @@
      %7D%0A%0A
+        return data;%0A    %7D%0A%0A    /**%0A     * @param serial%0A     * @return a JSONObject containing the passed-in serial.%0A     */%0A    public static JSONObject bundleSerialToJSON(String serial) %7B%0A        JSONObject data = new JSONObject();%0A%0A        try %7B%0A            data.put(%22serial%22, serial);%0A        %7D catch (JSONException e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A
         

add a method which bundles a string serial into a JSONObject.