Package org.json

Examples of org.json.JSONStringer.array()


     *             When JSON string could not be constructed.
     */
    public String getMidiDeviceInfo() throws JSONException
    {
        final JSONStringer js = new JSONStringer();
        js.array();
        for (final Info info : MidiSystem.getMidiDeviceInfo())
        {
            js.object();
            js.key("name").value(info.getName());
            js.key("description").value(info.getDescription());
View Full Code Here


     */
    public String getReceivers(final int deviceHandle) throws JSONException
    {
        final MidiDevice device = resolveDeviceHandle(deviceHandle);
        final JSONStringer json = new JSONStringer();
        json.array();
        for (final Receiver receiver : device.getReceivers())
        {
            json.value(System.identityHashCode(receiver));
        }
        json.endArray();
View Full Code Here

     */
    public String getTransmitters(final int deviceHandle) throws JSONException
    {
        final MidiDevice device = resolveDeviceHandle(deviceHandle);
        final JSONStringer json = new JSONStringer();
        json.array();
        for (final Transmitter transmitter : device.getTransmitters())
        {
            json.value(System.identityHashCode(transmitter));
        }
        json.endArray();
View Full Code Here

        {
            final JSONStringer json = new JSONStringer();
            json.object();
            json.key("status").value(message.getStatus());
            json.key("message");
            json.array();
            final byte[] data = message.getMessage();
            final int max = Math.min(data.length, message.getLength());
            for (int i = 0; i < max; i++)
                json.value(data[i] & 0xff);
            json.endArray();
View Full Code Here

  public static String getSampleJsonString(int numRows) {
    JSONStringer x = new JSONStringer();
    Random rand = new Random(0);
    try {
      JSONWriter top = x.array();
      for (int i = 1; i <= numRows; i++) {
        JSONWriter o = top.object();
        o.key("a").value("a" + i);

        o.key("b").value("b" + i);
View Full Code Here

  public static String getJsonForUnitTest1() {
    JSONStringer x = new JSONStringer();
    Random rand = new Random(0);
    try {
      JSONWriter top = x.array();
      for (int i = 1; i <= 2; i++) {
        JSONWriter o = top.object();
        o.key("a").value("a" + i);

        o.key("b").value("b" + i);
View Full Code Here

  public static String getJsonForUnitTest4() {
    JSONStringer x = new JSONStringer();
    Random rand = new Random(0);
    try {
      JSONWriter top = x.array();
      for (int i = 1; i <= 1; i++) {
        JSONWriter o = top.object();

        JSONWriter c = o.key("c").array();
        for (int ci = 1; ci <= 3; ci++) {
View Full Code Here

  public static String getJsonForUnitTest5() {
    JSONStringer x = new JSONStringer();
    Random rand = new Random(0);
    try {
      JSONWriter top = x.array();
      for (int i = 1; i <= 1; i++) {
        JSONWriter o = top.object();

        JSONWriter c = o.key("c").array();
        for (int ci = 1; ci <= 4; ci++) {
View Full Code Here

  public static String getJsonForUnitTest6() {
    JSONStringer x = new JSONStringer();
    Random rand = new Random(0);
    try {
      JSONWriter top = x.array();
      for (int i = 1; i <= 1; i++) {
        JSONWriter o = top.object();

        JSONWriter c = o.key("c").array();
        for (int ci = 1; ci <= 1; ci++) {
View Full Code Here

      Workspace workspace) {
    try {

      JSONStringer x = new JSONStringer();

      JSONWriter topA = x.array();
      topA.object().key("a").value("a_1").key("b").array()
          //
          .object().key("b.1").value("b.1_1").key("b.2")
          .value("b.2_1").endObject()
          //
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.