Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Iterator;
import java.util.ArrayList;

import org.json.JSONObject;

public class Main {
    public static String[] getJSONObjectKeys(JSONObject inputObject) {
        Iterator keys = inputObject.keys();
        ArrayList<String> objectKeys = new ArrayList<String>();

        while (keys != null && keys.hasNext()) {
            objectKeys.add((String) keys.next());
        }
        String[] returnArray = new String[objectKeys.size()];
        return objectKeys.toArray(returnArray);
    }
}