- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- Re: getting Error Invalid Json Format
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2014 06:06 AM
08-19-2014 06:06 AM
getting Error Invalid Json Format
Hi
We are trying to parse the response from of REST command "/v2.0/net/nodes" and then we are getting an error INVALID JSON format.
Below is the snippet of code.
@GET
@Produces(MediaType.APPLICATION_JSON)
/* it returns the device information in a way the this
* Device is connected with the particular switch.
*/
private String getDeviceInfo(String hostMac) {
IpAddress ipAddress;
ipAddress=IpAddress.valueOf("127.0.0.1");
URI uri = restClient.uri(ipAddress, BASE_DESTINATION_PATH);
ResponseData response = restClient.get(restClient.login(), uri);
String responseData;
try {
responseData = new String(response.data(), StringUtils.UTF8);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(
"Unable to decode response from " + ipAddress, e);
}
log.warn("in getdeviceinfo() going to parse>>>>>>>.........");
List<Switch> remote=jsonService.fromJsonList(responseData, Switch.class);
log.warn("in getdeviceinfo() with mac returned as"+ remote.get(0).getMac());
return null;
}
The higlighted line generates an error :-
Caused by: com.hp.util.json.JsonCodecException: Invalid JSON format.
at com.hp.util.json.AbstractJsonCodec.decodeList(AbstractJsonCodec.java:119)
at com.hp.util.json.JSON.fromJsonList(JSON.java:82)
at com.hp.sdn.rs.FlareJsonProvider.fromJsonList(FlareJsonProvider.java:87)
at com.aricent.test.impl.LoadBalancerManager.getDeviceInfo(LoadBalancerManager.java:860)
at com.aricent.test.impl.LoadBalancerManager.check(LoadBalancerManager.java:562)
at com.aricent.test.impl.LoadBalancerManager.activate(LoadBalancerManager.java:254)
... 57 common frames omitted
Are we missing anything, any help will be appreciated.
Thanks
Gurtej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2014 11:21 AM
09-02-2014 11:21 AM
Re: getting Error Invalid Json Format
Hello Gurtej,
Please make sure that the BASE_DESTINATION_PATH( which is of type String for e.g. "sdn/hm/v1.0/switches" ) , restClient (which is of type ServiceRest) and jsonService (which is of JsonService) is properly defined in the code.Also check that Switch.class is properly included.
If you are still facing the problem , please share your code.
Thanks,
HP SDN Team