Object to Json conversion [duplicate]
This question already has an answer here:
Best practice to Serialize java.time.LocalDateTime (java 8) to js Date using GSON
2 answers
How to serialize and deserialize Java 8's java.time types with Gson? [closed]
1 answer
I am converting my object to json.
Converted first my object to a Map.
It works fine fine for all the properties,except for except for properties of type "LocalDateTime".For "LocalDateTime" properties i am expecting value should be displayed in a single line like:
"UpdatedTimestamp": "2018-10-09T16:57:57.176",
But it displays like:
"UpdatedTimestamp": {
"dayOfYear": 326,
"dayOfWeek": "THURSDAY",
"month": "NOVEMBER",
"dayOfMonth": 22,
"year": 2018,
"monthValue": 11,
"hour": 1,
"minute": 14,
"second": 48,
"nano": 572000000,
"chronology": {
"id": "ISO",
"calendarType": "iso8601"
}
},
My current code:
Gson gson = new Gson();
String json = gson.toJson(object.getMap());
java json rest file gson
marked as duplicate by shmosel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 22 '18 at 3:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Best practice to Serialize java.time.LocalDateTime (java 8) to js Date using GSON
2 answers
How to serialize and deserialize Java 8's java.time types with Gson? [closed]
1 answer
I am converting my object to json.
Converted first my object to a Map.
It works fine fine for all the properties,except for except for properties of type "LocalDateTime".For "LocalDateTime" properties i am expecting value should be displayed in a single line like:
"UpdatedTimestamp": "2018-10-09T16:57:57.176",
But it displays like:
"UpdatedTimestamp": {
"dayOfYear": 326,
"dayOfWeek": "THURSDAY",
"month": "NOVEMBER",
"dayOfMonth": 22,
"year": 2018,
"monthValue": 11,
"hour": 1,
"minute": 14,
"second": 48,
"nano": 572000000,
"chronology": {
"id": "ISO",
"calendarType": "iso8601"
}
},
My current code:
Gson gson = new Gson();
String json = gson.toJson(object.getMap());
java json rest file gson
marked as duplicate by shmosel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 22 '18 at 3:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Best practice to Serialize java.time.LocalDateTime (java 8) to js Date using GSON
2 answers
How to serialize and deserialize Java 8's java.time types with Gson? [closed]
1 answer
I am converting my object to json.
Converted first my object to a Map.
It works fine fine for all the properties,except for except for properties of type "LocalDateTime".For "LocalDateTime" properties i am expecting value should be displayed in a single line like:
"UpdatedTimestamp": "2018-10-09T16:57:57.176",
But it displays like:
"UpdatedTimestamp": {
"dayOfYear": 326,
"dayOfWeek": "THURSDAY",
"month": "NOVEMBER",
"dayOfMonth": 22,
"year": 2018,
"monthValue": 11,
"hour": 1,
"minute": 14,
"second": 48,
"nano": 572000000,
"chronology": {
"id": "ISO",
"calendarType": "iso8601"
}
},
My current code:
Gson gson = new Gson();
String json = gson.toJson(object.getMap());
java json rest file gson
This question already has an answer here:
Best practice to Serialize java.time.LocalDateTime (java 8) to js Date using GSON
2 answers
How to serialize and deserialize Java 8's java.time types with Gson? [closed]
1 answer
I am converting my object to json.
Converted first my object to a Map.
It works fine fine for all the properties,except for except for properties of type "LocalDateTime".For "LocalDateTime" properties i am expecting value should be displayed in a single line like:
"UpdatedTimestamp": "2018-10-09T16:57:57.176",
But it displays like:
"UpdatedTimestamp": {
"dayOfYear": 326,
"dayOfWeek": "THURSDAY",
"month": "NOVEMBER",
"dayOfMonth": 22,
"year": 2018,
"monthValue": 11,
"hour": 1,
"minute": 14,
"second": 48,
"nano": 572000000,
"chronology": {
"id": "ISO",
"calendarType": "iso8601"
}
},
My current code:
Gson gson = new Gson();
String json = gson.toJson(object.getMap());
This question already has an answer here:
Best practice to Serialize java.time.LocalDateTime (java 8) to js Date using GSON
2 answers
How to serialize and deserialize Java 8's java.time types with Gson? [closed]
1 answer
java json rest file gson
java json rest file gson
edited Nov 22 '18 at 3:29
shmosel
37k43996
37k43996
asked Nov 22 '18 at 3:28
vasuvasu
416
416
marked as duplicate by shmosel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 22 '18 at 3:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by shmosel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 22 '18 at 3:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes