tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 JSON > JSON SIMPLE > List to JSON Array

List to JSON Array 

JSON Simple is a java library for encoding and decoding JSON text. Get the latest binaries from The following example shows converting a list to JSON Array.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.json_simple.tests;

import java.util.ArrayList;
import java.util.List;

import org.json.simple.JSONValue;

public class List2JsonArray {

   @param args
  public static void main(String[] args) {

    List list = new ArrayList();
    list.add(new Integer(2));
    list.add(new Long(3));
    list.add(new Double(4.26));
    String jsonStr = JSONValue.toJSONString(list);


It gives the following output,


bl  br