Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.Transient;
Expand All @@ -34,6 +35,7 @@
*/
@Region("simple")
@JsonIgnoreProperties("name")
@JsonPropertyOrder({"address", "firstname", "id", "lastname"})
public class Person implements Serializable {

private static final long serialVersionUID = 508843183613325255L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import javax.annotation.Resource;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import com.fasterxml.jackson.databind.SerializationConfig;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.SelectResults;

Expand Down Expand Up @@ -78,7 +80,8 @@ public void setup() {
private static String toJson(Object bean) {

try {
return new ObjectMapper().writeValueAsString(bean);
ObjectMapper mapper = new ObjectMapper().configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
return mapper.writeValueAsString(bean);
}
catch (JsonProcessingException cause) {
throw newIllegalArgumentException(cause, "Failed to convert object (%1$s) into JSON", bean);
Expand Down