示例#1
0
 private JsonArray testParseHelper(String objStr) {
   try {
     return new TestArray(objStr, false);
   } catch (JsonParseException e) {
     previousError = e.getMessage();
     e.printStackTrace();
     return null;
   }
 }
  public static WrappedStack createFromJson(String jsonWrappedObject) throws JsonParseException {
    try {
      return jsonSerializer.fromJson(jsonWrappedObject, WrappedStack.class);
    } catch (JsonSyntaxException exception) {
      exception.printStackTrace();
    } catch (JsonParseException exception) {
      exception.printStackTrace();
    }

    return null;
  }
  /**
   * Deserializes an EmcValue object from the given serialized json String
   *
   * @param jsonEnergyValue Json encoded String representing a EmcValue object
   * @return The EmcValue that was encoded as json, or null if a valid EmcValue could not be decoded
   *     from given String
   */
  @SuppressWarnings("unused")
  public static EnergyValue createFromJson(String jsonEnergyValue) {
    try {
      return jsonSerializer.fromJson(jsonEnergyValue, EnergyValue.class);
    } catch (JsonSyntaxException exception) {
      exception.printStackTrace();
    } catch (JsonParseException exception) {
      exception.printStackTrace();
    }

    return null;
  }