001 /*
002 * Apache License
003 * Version 2.0, January 2004
004 * http://www.apache.org/licenses/
005 *
006 * Copyright 2008 by chenillekit.org
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 */
015
016 package org.chenillekit.google.utils;
017
018 /**
019 * The <code>JSONString</code> interface allows a <code>toJSONString()</code>
020 * method so that a class can change the behavior of
021 * <code>JSONObject.toString()</code>, <code>JSONArray.toString()</code>,
022 * and <code>JSONWriter.value(</code>Object<code>)</code>. The
023 * <code>toJSONString</code> method will be used instead of the default behavior
024 * of using the Object's <code>toString()</code> method and quoting the result.
025 */
026 public interface JSONString
027 {
028 /**
029 * The <code>toJSONString</code> method allows a class to produce its own JSON
030 * serialization.
031 *
032 * @return A strictly syntactically correct JSON text.
033 */
034 public String toJSONString();
035 }