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










share|improve this question
























  • 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















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










share|improve this question
























  • 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













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










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 22:15









marc_s

565k12610921244




565k12610921244










asked Nov 1 at 11:04









Sajan Parmar

112




112












  • 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


















  • 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
















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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Bressuire

Vorschmack

Quarantine