Questions tagged [json-view]

85 questions
1
vote
1 answer

Objectmapper.readerforupdating not working for nested objects

I have a problem with Objectmapper.readerforupdating using different write permissions with the help of views, it is working fine on main entity but not on nested objects. I have the following example: public class A { …
1
vote
1 answer

Disable validation annotation when filtering with Jackson @JsonView

I have the same form that displays more or less fields depending on the user's role. So I use @JsonView to hide/ignore the fields that are not related to the current user's role. But the validation is still enabled and the @NotNull rule is…
Jedupont
  • 401
  • 1
  • 4
  • 12
1
vote
1 answer

JSON don't repeat some attributes and respective values

for all instances serialized, from the second occurrence onwards, of the same model class, the objects only have a part of the attributes and their respective values ​​that they should. This way the JSON file structure is not homogeneous and uniform…
1
vote
1 answer

Jackson @JsonView is not working when I have a getter for internal variable

I have these two calsses Human and User and they look like : public class User{ @JsonView(ExternalCategoriesViews.CustomCategoryExternalView.class) protected Long id; @JsonView(ExternalCategoriesViews.CustomCategoryExternalView.class) …
bashar
  • 135
  • 2
  • 11
1
vote
1 answer

JsonIgnore except one endpoint

I am developing app using spring boot and I just want to ignore a field while returning to the client but except one endpoint. public class MyJwt { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Lob @JsonIgnore private…
Mesut Can
  • 291
  • 2
  • 5
  • 19
1
vote
0 answers

@JsonView is not working with inheritance

I'm using @JsonView on simple classes (without inheritance) and it works fine. But I have another case : class B, C, D inheriting A and Class A inherits T. I put the @JsonView in th right get methods, but the filter is not working I always get all…
Amira
  • 3,184
  • 13
  • 60
  • 95
1
vote
1 answer

How to apply a JsonView to a nested entity

I have the following JsonViews defined: public class EntityJsonView { public static class Detailed extends Abbreviated { } public static class AuditedDetailed extends Detailed { } public static class Abbreviated { …
1
vote
1 answer

Spring boot JPA: recursion on JSON-view in a self join relationShip

For a project that I am trying to build, I need a manyToMany relationship From the User Class to the Class User.(Users have Friends and Friends are friends of Users). When trying to get Json out of SpringBoot with JPA. I get a recursive loop on my…
1
vote
0 answers

Render JSON in controller action

I have a Grails 3.3.8 app with compile 'org.grails.plugins:views-json' compile 'org.grails.plugins:views-json-templates' and a json view under views/partner/_companion.gson: import io.my.domain.Companion model { Companion companion } json { …
injecteer
  • 20,038
  • 4
  • 45
  • 89
1
vote
1 answer

JsonView ignore all but annotated properties

I have the following JsonView configuration: public class JsonViews { public static class AdminView { } public static class PublicView extends AdminView { } } I have the following entity: public class UserEntity { …
SexyMF
  • 10,657
  • 33
  • 102
  • 206
1
vote
1 answer

Set DEFAULT_VIEW_INCLUSION in YAML file not working for MapperFeature.DEFAULT_VIEW_INCLUSION

I have set following in spring boot yaml file. But not working. I checked the question Set DEFAULT_VIEW_INCLUSION in YAML file. But there they have given answer for new custom objectmapper object, but not using the spring convertor object.…
A MJ
  • 115
  • 1
  • 9
1
vote
1 answer

Class and field level @JsonView annotation and Object Mapper

I have views and entity class as shown below: class Views{ class ViewOne{} class ViewTwo{} } class Test{ @JsonView({Views.ViewOne.class}) public int x; @JsonView({Views.ViewTwo.class}) public int y; public int z; public…
Yug Singh
  • 3,112
  • 5
  • 27
  • 52
1
vote
1 answer

Error creating bean with name 'jsonView' defined in ServletContext resource

I don't understand why this problem caused. Anyone who knows this problem? I tried to change prefix folder(WEB-INF/jsp) and to insert jackson dependency code in pom.xml bottom of this text is Error log Error…
1
vote
1 answer

How to render different types of objects in the same list with grails json views?

I have a structure of classes as: class A { ... } class B extends A { ... } class C extends A { ... } No, in the controller I am fetching a list of objects of mixed types: A[] objects = bethodTpFetchTheList() In the view, I need to render the…
Shurik Agulyansky
  • 2,607
  • 2
  • 34
  • 76
1
vote
0 answers

SAP Eclipse Debugging and Json viewer for variable content

I have installed a JSON plugin in Eclipse that was tagged as editor and viewer Unfortunately after restart when debugging ABAP variables, the JSON viewer is not offered. Just the standard 5 offerings. Is there a way when debugging abap variables…
phil soady
  • 11,043
  • 5
  • 50
  • 95