Questions tagged [json-view]
85 questions
0
votes
2 answers
Grails 3 gson views and domain class template
I'm playing around with Grails 3, specifically REST Api support features.
One of the new features (coming from 2.5.5) is the new gson views.
I'm trying to follow the documentation, but my template seems to be ignored.
I've made my sample project…

Townsfolk
- 1,282
- 1
- 9
- 21
0
votes
1 answer
Grails 3 : Class inheritance not working with json-views
I'm trying to render json-views from a result of a polymorphic query.
With object marshallers, it works perfectly, but not with grails3 json-views.
I tried all sort of things, it seems like a bug in json-views plugin.
Here is an example to clarify…

Reda Kim
- 31
- 1
- 6
0
votes
1 answer
Spring Jackson JsonViews - Get Fields based on JsonView
I've got an entity with a number of fields and with a JsonView specified:
public class Client {
@JsonView(Views.ClientView.class)
@Column(name = "clientid")
private long clientId;
@JsonView(Views.ClientView.class)
@Column(name =…

cgval
- 1,096
- 5
- 14
- 31
0
votes
1 answer
"customer" Object only has "null" values when we post a customer
have an application here which is using @JsonViews to manipulation the json output of entities from webservices.
public class Customer implements Serializable {
@Id
@JsonView(ListView.class)
private String customerID;
@NotNull
@Size(min =…

Hemant Desusa
- 181
- 2
- 6
0
votes
1 answer
Is adding @JsonView(Views.Public.class) necessary to enable AJAX call to controller?
I'm recently trying to build an small webapp to enable AJAX call my controller and return the JSON result. I understand the annotation
@JsonView(Views.Public.class)
serves as a filter to exclude all fields that you don't want them to be serialized.…

OD Street
- 1,067
- 3
- 14
- 21
0
votes
1 answer
@JsonView declaration for whole Spring MVC rest controler
Is there some way how I can declare @JsonView for whole Spring MVC rest controller?
I know I can declare @JsonView for particular method like this:
@RequestMapping(value = "/user", method = RequestMethod.G
…

Ondrej Bozek
- 10,987
- 7
- 54
- 70
0
votes
1 answer
Jackson JSON - @JsonProperty overriding @JsonView?
I have the following class:
class Bean {
private int x;
private int y;
public Bean(int x, int y) {
this.x = x;
this.y = y;
}
@JsonProperty("x")
@JsonView(View1.class)
public void setX(int x) {
…

755
- 2,991
- 3
- 20
- 34
0
votes
1 answer
set RequestHandler to use XmlView by default
I'm using the Xml/Json views for an API.
Going to '/Api.json' or '/Api.xml' works fine, but I'd like it to default to the XmlView when posting to '/Api'
What's the most simple/best way get this done?
Edit:
As Jelmer mentioned, just doing…

Nico
- 559
- 4
- 22
-1
votes
1 answer
Can I serialize a property using a Jackson @JsonView?
I have a complicated class in my REST API:
class Complicated {
String foo
Integer bar
Instant baz
...
// lots more
}
I also have another class that contains a collection of Complicated:
class HasComplications {
String…

chrylis -cautiouslyoptimistic-
- 75,269
- 21
- 115
- 152