com.alipay.api.internal.util.json.JSONReader Java Examples
The following examples show how to use
com.alipay.api.internal.util.json.JSONReader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonConverter.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
public <T extends AlipayResponse> T toResponse(String rsp, Class<T> clazz) throws AlipayApiException { JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(rsp); if (rootObj instanceof Map<?, ?>) { Map<?, ?> rootJson = (Map<?, ?>) rootObj; Collection<?> values = rootJson.values(); for (Object rspObj : values) { if (rspObj instanceof Map<?, ?>) { Map<?, ?> rspJson = (Map<?, ?>) rspObj; return fromJson(rspJson, clazz); } } } return null; }
Example #2
Source File: JsonConverter.java From alipay-sdk with Apache License 2.0 | 6 votes |
public <T extends AlipayResponse> T toResponse(String rsp, Class<T> clazz) throws AlipayApiException { JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(rsp); if (rootObj instanceof Map<?, ?>) { Map<?, ?> rootJson = (Map<?, ?>) rootObj; Collection<?> values = rootJson.values(); for (Object rspObj : values) { if (rspObj instanceof Map<?, ?>) { Map<?, ?> rspJson = (Map<?, ?>) rspObj; return fromJson(rspJson, clazz); } } } return null; }
Example #3
Source File: JsonConverter.java From pay with Apache License 2.0 | 6 votes |
public <T extends AlipayResponse> T toResponse(String rsp, Class<T> clazz) throws AlipayApiException { JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(rsp); if (rootObj instanceof Map<?, ?>) { Map<?, ?> rootJson = (Map<?, ?>) rootObj; Collection<?> values = rootJson.values(); for (Object rspObj : values) { if (rspObj instanceof Map<?, ?>) { Map<?, ?> rspJson = (Map<?, ?>) rspObj; return fromJson(rspJson, clazz); } } } return null; }
Example #4
Source File: JsonConverter.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.internal.mapping.Converter#getCertItem(com.alipay.api.AlipayRequest, String) */ public CertItem getCertItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { // 响应为空则直接返回 if (StringUtils.isEmpty(responseBody)) { return null; } CertItem certItem = new CertItem(); JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(responseBody); Map<?, ?> rootJson = (Map<?, ?>) rootObj; // 获取签名 String sign = (String) rootJson.get(AlipayConstants.SIGN); certItem.setSign(sign); //获取证书序列号 String cert = (String) rootJson.get(AlipayConstants.ALIPAY_CERT_SN); certItem.setCert(cert); // 签名源串 String signSourceData = getSignSourceData(request, responseBody); certItem.setSignSourceDate(signSourceData); return certItem; }
Example #5
Source File: JsonConverter.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
/** * 获取签名 * * @param body * @return */ private String getSign(String body) { JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(body); Map<?, ?> rootJson = (Map<?, ?>) rootObj; return (String) rootJson.get(AlipayConstants.SIGN); }
Example #6
Source File: AlipayUtils.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
/** * 把JSON字符串转化为Map结构。 * * @param body JSON字符串 * @return Map结构 */ public static Map<?, ?> parseJson(String body) { JSONReader jr = new JSONValidatingReader(); Object obj = jr.read(body); if (obj instanceof Map<?, ?>) { return (Map<?, ?>) obj; } else { return null; } }
Example #7
Source File: JsonConverter.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * 获取签名 * * @param body * @return */ private String getSign(String body) { JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(body); Map<?, ?> rootJson = (Map<?, ?>) rootObj; return (String) rootJson.get(AlipayConstants.SIGN); }
Example #8
Source File: AlipayUtils.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * 把JSON字符串转化为Map结构。 * * @param body JSON字符串 * @return Map结构 */ public static Map<?, ?> parseJson(String body) { JSONReader jr = new JSONValidatingReader(); Object obj = jr.read(body); if (obj instanceof Map<?, ?>) { return (Map<?, ?>) obj; } else { return null; } }
Example #9
Source File: JsonConverter.java From pay with Apache License 2.0 | 5 votes |
/** * 获取签名 * * @param body * @return */ private String getSign(String body) { JSONReader reader = new JSONValidatingReader(new ExceptionErrorListener()); Object rootObj = reader.read(body); Map<?, ?> rootJson = (Map<?, ?>) rootObj; return (String) rootJson.get(AlipayConstants.SIGN); }
Example #10
Source File: AlipayUtils.java From pay with Apache License 2.0 | 5 votes |
/** * 把JSON字符串转化为Map结构。 * * @param body JSON字符串 * @return Map结构 */ public static Map<?, ?> parseJson(String body) { JSONReader jr = new JSONValidatingReader(); Object obj = jr.read(body); if (obj instanceof Map<?, ?>) { return (Map<?, ?>) obj; } else { return null; } }