/** *To create JSON byte array from PdxInstance * * @return the JSON byte array. * @throws JSONFormatterException if unable to create JSON doucment from PdxInstance */ public static byte[] toJSONByteArray(PdxInstance pdxInstance) { try { PdxToJSON pj = new PdxToJSON(pdxInstance); return pj.getJSONByteArray(); } catch (Exception e) { throw new JSONFormatterException("Could not create JSON document from PdxInstance ", e); } }
/** * To create PdxInstance from JSON string * * @return the PdxInstance. * @throws JSONFormatterException if unable to parse JSON doucment */ public static PdxInstance fromJSON(String jsonString) { JsonParser jp = null; try { jp = new JsonFactory().createParser(jsonString); enableJSONParserFeature(jp); return new JSONFormatter().getPdxInstance(jp, states.NONE, null).getPdxInstance(); } catch (JsonParseException jpe) { throw new JSONFormatterException("Could not parse JSON document " , jpe); } catch (IOException e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } catch(Exception e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } }
/** *To create JSON string from PdxInstance * * @return the JSON string. * @throws JSONFormatterException if unable to create JSON doucment from PdxInstance */ public static String toJSON(PdxInstance pdxInstance) { try { PdxToJSON pj = new PdxToJSON(pdxInstance); return pj.getJSON(); } catch (Exception e) { throw new JSONFormatterException("Could not create JSON document from PdxInstance ", e); } }
/** *To create JSON string from PdxInstance * * @return the JSON string. * @throws JSONFormatterException if unable to create JSON doucment from PdxInstance */ public static String toJSON(PdxInstance pdxInstance) { try { PdxToJSON pj = new PdxToJSON(pdxInstance); return pj.getJSON(); } catch (Exception e) { throw new JSONFormatterException("Could not create JSON document from PdxInstance ", e); } }
/** *To create JSON byte array from PdxInstance * * @return the JSON byte array. * @throws JSONFormatterException if unable to create JSON doucment from PdxInstance */ public static byte[] toJSONByteArray(PdxInstance pdxInstance) { try { PdxToJSON pj = new PdxToJSON(pdxInstance); return pj.getJSONByteArray(); } catch (Exception e) { throw new JSONFormatterException("Could not create JSON document from PdxInstance ", e); } }
/** * To create PdxInstance from JSON string * * @return the PdxInstance. * @throws JSONFormatterException if unable to parse JSON doucment */ public static PdxInstance fromJSON(byte[] jsonByteArray) { JsonParser jp = null; try { jp = new JsonFactory().createParser(jsonByteArray); enableJSONParserFeature(jp); return new JSONFormatter().getPdxInstance(jp, states.NONE, null).getPdxInstance(); } catch (JsonParseException jpe) { throw new JSONFormatterException("Could not parse JSON document " , jpe); } catch (IOException e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } catch(Exception e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } }
/** * To create PdxInstance from JSON string * * @return the PdxInstance. * @throws JSONFormatterException if unable to parse JSON doucment */ public static PdxInstance fromJSON(byte[] jsonByteArray) { JsonParser jp = null; try { jp = new JsonFactory().createJsonParser(jsonByteArray); enableJSONParserFeature(jp); return new JSONFormatter().getPdxInstance(jp, states.NONE, null).getPdxInstance(); } catch (JsonParseException jpe) { throw new JSONFormatterException("Could not parse JSON document " , jpe); } catch (IOException e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } catch(Exception e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } }
/** * To create PdxInstance from JSON string * * @return the PdxInstance. * @throws JSONFormatterException if unable to parse JSON doucment */ public static PdxInstance fromJSON(String jsonString) { JsonParser jp = null; try { jp = new JsonFactory().createJsonParser(jsonString); enableJSONParserFeature(jp); return new JSONFormatter().getPdxInstance(jp, states.NONE, null).getPdxInstance(); } catch (JsonParseException jpe) { throw new JSONFormatterException("Could not parse JSON document " , jpe); } catch (IOException e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } catch(Exception e) { throw new JSONFormatterException("Could not parse JSON document: " + jp.getCurrentLocation(), e); } }