Java Utililty Methods Json String Create

List of utility methods to do Json String Create

Description

The list of methods to do Json String Create are organized into topic(s).

Method

StringtoJsonField(String name, String value)
to Json Field
return "\"" + name + "\":\"" + value + "\"";
StringtoJsonName(String name, int prefixLen)
Convert given name to the Json object name.
return Character.toLowerCase(name.charAt(prefixLen)) + name.substring(prefixLen + 1);
StringtoJsonUrl(String pUrl)
to Json Url
if (pUrl.endsWith(".xml")) {
    throw new IllegalArgumentException("HttpHelper was passed a Uri which explicitly "
            + "asked for a different format: '" + pUrl + "'!");
if (pUrl.endsWith("/")) {
    pUrl = pUrl.substring(0, pUrl.length() - 1);
if (!pUrl.endsWith(".json")) {
...
StringtoJSONValue(Enum e)
to JSON Value
if (e == null) {
    return null;
return e.name();
voidwrite2Json(String json, String path, String name)
write Json
File pathFile = new File(path);
if (!pathFile.isDirectory()) {
    throw new FileNotFoundException();
if (!pathFile.exists()) {
    pathFile.mkdirs();
if (name == null) {
...