retrieve json is in wrong format in java
up vote
0
down vote
favorite
I want retrieve json from postgres sql and I will convert it to a plain string.
I want full json with json String.
DeviceProfile dp = device.getDp();
System.out.println("parameters Data:: "+dp.getParameters().toString());
JSONObject parameters = new ObjectMapper().readValue(dp.getParameters().toString(),JSONObject.class);
It will print following String which is wrong.
{Rs232=[{rs232unit=, parameterId=6, rs232ioindex=1.0, parametername=rs232}], Digital=[{reverse=true, dioindex=1.0, parameterId=1, parametername=Ignition}]}
I want proper json.
I am using jsckson api to parse data.
See database Screen Short
java jackson
add a comment |
up vote
0
down vote
favorite
I want retrieve json from postgres sql and I will convert it to a plain string.
I want full json with json String.
DeviceProfile dp = device.getDp();
System.out.println("parameters Data:: "+dp.getParameters().toString());
JSONObject parameters = new ObjectMapper().readValue(dp.getParameters().toString(),JSONObject.class);
It will print following String which is wrong.
{Rs232=[{rs232unit=, parameterId=6, rs232ioindex=1.0, parametername=rs232}], Digital=[{reverse=true, dioindex=1.0, parameterId=1, parametername=Ignition}]}
I want proper json.
I am using jsckson api to parse data.
See database Screen Short
java jackson
Are you suredp.getParameters().toString()
would return JSON?
– Henry
Nov 1 at 11:12
it will return json which is stored in database. i had attached a screen short also.
– Sajan Parmar
Nov 1 at 11:26
Obviously, it doesn't. What makes you think it would? IsDeviceProfile
one of your classes? I would start to look there.
– Henry
Nov 1 at 11:32
Yes DeviceProfile is my Model Class.
– Sajan Parmar
Nov 1 at 11:33
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want retrieve json from postgres sql and I will convert it to a plain string.
I want full json with json String.
DeviceProfile dp = device.getDp();
System.out.println("parameters Data:: "+dp.getParameters().toString());
JSONObject parameters = new ObjectMapper().readValue(dp.getParameters().toString(),JSONObject.class);
It will print following String which is wrong.
{Rs232=[{rs232unit=, parameterId=6, rs232ioindex=1.0, parametername=rs232}], Digital=[{reverse=true, dioindex=1.0, parameterId=1, parametername=Ignition}]}
I want proper json.
I am using jsckson api to parse data.
See database Screen Short
java jackson
I want retrieve json from postgres sql and I will convert it to a plain string.
I want full json with json String.
DeviceProfile dp = device.getDp();
System.out.println("parameters Data:: "+dp.getParameters().toString());
JSONObject parameters = new ObjectMapper().readValue(dp.getParameters().toString(),JSONObject.class);
It will print following String which is wrong.
{Rs232=[{rs232unit=, parameterId=6, rs232ioindex=1.0, parametername=rs232}], Digital=[{reverse=true, dioindex=1.0, parameterId=1, parametername=Ignition}]}
I want proper json.
I am using jsckson api to parse data.
See database Screen Short
java jackson
java jackson
edited Nov 10 at 22:15
marc_s
565k12610921244
565k12610921244
asked Nov 1 at 11:04
Sajan Parmar
112
112
Are you suredp.getParameters().toString()
would return JSON?
– Henry
Nov 1 at 11:12
it will return json which is stored in database. i had attached a screen short also.
– Sajan Parmar
Nov 1 at 11:26
Obviously, it doesn't. What makes you think it would? IsDeviceProfile
one of your classes? I would start to look there.
– Henry
Nov 1 at 11:32
Yes DeviceProfile is my Model Class.
– Sajan Parmar
Nov 1 at 11:33
add a comment |
Are you suredp.getParameters().toString()
would return JSON?
– Henry
Nov 1 at 11:12
it will return json which is stored in database. i had attached a screen short also.
– Sajan Parmar
Nov 1 at 11:26
Obviously, it doesn't. What makes you think it would? IsDeviceProfile
one of your classes? I would start to look there.
– Henry
Nov 1 at 11:32
Yes DeviceProfile is my Model Class.
– Sajan Parmar
Nov 1 at 11:33
Are you sure
dp.getParameters().toString()
would return JSON?– Henry
Nov 1 at 11:12
Are you sure
dp.getParameters().toString()
would return JSON?– Henry
Nov 1 at 11:12
it will return json which is stored in database. i had attached a screen short also.
– Sajan Parmar
Nov 1 at 11:26
it will return json which is stored in database. i had attached a screen short also.
– Sajan Parmar
Nov 1 at 11:26
Obviously, it doesn't. What makes you think it would? Is
DeviceProfile
one of your classes? I would start to look there.– Henry
Nov 1 at 11:32
Obviously, it doesn't. What makes you think it would? Is
DeviceProfile
one of your classes? I would start to look there.– Henry
Nov 1 at 11:32
Yes DeviceProfile is my Model Class.
– Sajan Parmar
Nov 1 at 11:33
Yes DeviceProfile is my Model Class.
– Sajan Parmar
Nov 1 at 11:33
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53099988%2fretrieve-json-is-in-wrong-format-in-java%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you sure
dp.getParameters().toString()
would return JSON?– Henry
Nov 1 at 11:12
it will return json which is stored in database. i had attached a screen short also.
– Sajan Parmar
Nov 1 at 11:26
Obviously, it doesn't. What makes you think it would? Is
DeviceProfile
one of your classes? I would start to look there.– Henry
Nov 1 at 11:32
Yes DeviceProfile is my Model Class.
– Sajan Parmar
Nov 1 at 11:33