23 lines
549 B
Java
23 lines
549 B
Java
package net.mindoverflow.webmarker.utils;
|
|
|
|
import com.google.gson.JsonObject;
|
|
import com.google.gson.JsonParser;
|
|
|
|
public class FileUtils {
|
|
|
|
|
|
public static JsonObject stringToJson(String body)
|
|
{
|
|
try {
|
|
JsonParser jsonParser = new JsonParser();
|
|
return (JsonObject) jsonParser.parse(body);
|
|
} catch (Exception e)
|
|
{
|
|
// todo: better exception (MalformedJsonException)
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// todo: move more conversion stuff to this class, maybe rename it too?
|
|
}
|