Package com.github.jsonj

Examples of com.github.jsonj.JsonArray


        }
        return jjArray;
    }

    public static <T> JsonArray array(T[] array) {
        JsonArray jjArray = new JsonArray();
        for(T e: array) {
            jjArray.add(fromObject(e));
        }
        return jjArray;
    }
View Full Code Here


        }
        return jjArray;
    }

    public static JsonArray array(int[] array) {
        JsonArray jjArray = new JsonArray();
        for(int e: array) {
            jjArray.add(e);
        }
        return jjArray;
    }
View Full Code Here

        }
        return jjArray;
    }

    public static JsonArray array(long[] array) {
        JsonArray jjArray = new JsonArray();
        for(long e: array) {
            jjArray.add(e);
        }
        return jjArray;
    }
View Full Code Here

        }
        return jjArray;
    }

    public static JsonArray array(float[] array) {
        JsonArray jjArray = new JsonArray();
        for(float e: array) {
            jjArray.add(e);
        }
        return jjArray;
    }
View Full Code Here

        }
        return jjArray;
    }

    public static JsonArray array(double[] array) {
        JsonArray jjArray = new JsonArray();
        for(double e: array) {
            jjArray.add(e);
        }
        return jjArray;
    }
View Full Code Here

    /**
     * @param elements strings
     * @return json array with all the elements added as JsonPrimitive
     */
    public static JsonArray array(final String... elements) {
        JsonArray jjArray = new JsonArray();
        for (String s : elements) {
            jjArray.add(primitive(s));
        }
        return jjArray;
    }
View Full Code Here

     * Allows you to add incomplete object builders without calling get()
     * @param elements json builders
     * @return json array with the builder objects
     */
    public static JsonArray array(final JsonBuilder... elements) {
        JsonArray jjArray = new JsonArray();
        for (JsonBuilder b : elements) {
            jjArray.add(b);
        }
        return jjArray;
    }
View Full Code Here

    /**
     * @param elements numbers
     * @return an array
     */
    public static JsonArray array(final Number... elements) {
        JsonArray jjArray = new JsonArray();
        for (Number n : elements) {
            jjArray.add(primitive(n));
        }
        return jjArray;
    }
View Full Code Here

        if(o instanceof JsonBuilder) {
            return ((JsonBuilder) o).get();
        } else if(o instanceof Map) {
            return new JsonObject((Map)o);
        } else if(o instanceof List) {
            return new JsonArray((List)o);
        }
        return primitive(o);
    }
View Full Code Here

     * arrays.
     * @param lineString 2d array of doubles
     * @return a JsonArray array
     */
    public static JsonArray toJsonJLineString(double[][] lineString) {
        JsonArray points = array();
        for (double[] values : lineString) {
            JsonArray subArray = array();
            for (double value : values) {
                subArray.add(primitive(value));
            }
            points.add(subArray);
        }

        return points;
View Full Code Here

TOP

Related Classes of com.github.jsonj.JsonArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.