JSONのシリアライズ、デシリアライズ

import com.amazonaws.util.json.JSONException;
import com.amazonaws.util.json.JSONObject;
import com.amazonaws.util.json.JSONTokener;

シリアライズ

Map<String, String> somethingMap;
JSONObject json = new JSONObject(somethingMap);

BufferedWriter writer = null;

try {
      writer =
        new BufferedWriter(new FileWriter(new File({filePath})));
      json.write(writer);
      writer.flush();
    } catch (IOException e) {
      throw new RuntimeException();
    } catch (JSONException e) {
      throw new RuntimeException();
    } finally {
      IOUtils.closeQuietly(writer);
    }

デシリアライズ

JSONObject json = null;

try {
        json =
          new JSONObject(new JSONTokener(new BufferedReader(new FileReader(
            {filePath}))));
      } catch (FileNotFoundException e) {
        throw new RuntimeException("file not found");
      } catch (JSONException e) {
        throw new RuntimeException();
      }