Here you can find the source of buildJsonArray(String[][] twoDimensionArray)
public static JsonArray buildJsonArray(String[][] twoDimensionArray)
//package com.java2s; //License from project: Apache License import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonArrayBuilder; public class Main { /** Builds two dimensional JsonArray form String[][] */ public static JsonArray buildJsonArray(String[][] twoDimensionArray) { JsonArrayBuilder keyboardBuilder = Json.createArrayBuilder(); for (String[] boardElement : twoDimensionArray) { JsonArrayBuilder key = Json.createArrayBuilder(); for (String keyElement : boardElement) { key.add(keyElement);//from ww w .j a v a 2 s.co m } keyboardBuilder.add(key.build()); } return keyboardBuilder.build(); } }