Questions tagged [json-view]

85 questions
1
vote
2 answers

Grails 3.1 JSON-Views, rendering a Category Tree

I'm using Graisl 3.1.1, rest-api profile. I'm trying to build a Category Tree but I haven some problems rendering the categories in JSON-Views. I'm using json templates, one for the parent and another for the child. Basically I want to generate a…
Adrian Rodriguez
  • 452
  • 4
  • 19
1
vote
0 answers

Using @JsonView in Spring MVC 4 + jackson 2.5

I am going to develop a JSON REST service using Spring MVC 4.0.4 , Hibernate 4.3.5 and Jackson 2.5.4. For the controllers i need the @JsonView to filter properties. I have annotated some of Model's properties with @JsonView(View.Summary.class) and…
Amin Shahnazari
  • 95
  • 1
  • 2
  • 7
1
vote
0 answers

@JsonView doesn't work for me (Spring 4.1.5, Jackson 2.5.1)

I have a field in my Entity with @JsonView annotation: @JsonView(View.Secure.class) private String password; Inside my controller: @RequestMapping(method = RequestMethod.GET, produces = "application/json") @JsonView(View.Secure.class) …
ivan_ochc
  • 392
  • 5
  • 22
1
vote
1 answer

Json Dynamic views spring MVC

I am kind of new to spring MVC and I wanted to use JasonViews (Jackson) for dynamic JSON per request and I didn't want to change my controllers too much .. so @marty here gave me a great solution in his blog…
assaf_miz84
  • 687
  • 2
  • 15
  • 33
0
votes
0 answers

ngx json viewer displays null characters as white space. How to I display it as a null character: [ \u0000 ]?

A null character (signified by unicode: "\u0000") appears in NGX json viewer as a white space. Is there a way to show it as the unicode ("\u0000") instead, within the NGX json viewer? In this example the null character is seen in both ways (space…
Zephram
  • 499
  • 3
  • 7
  • 16
0
votes
0 answers

validation in JsonView and grouping of interfaces in @JsonView

I have created DTO , which is having fields, associated with different jsonview, so that only those vields are there in RequestBody and ResponseBody DTO. Below is the sample code: public class Test { @JsonView({ //Request Views …
KCS
  • 2,937
  • 4
  • 22
  • 32
0
votes
1 answer

Json View doesn't restrict the fields in the response

I need to send only 1 field annotated with @JsonView(in my case : eNumber) in my response. Also, this has to be only when the call is from Controller1 which also has a JsonView annotation. But, eNumber field value is sent also when the call is from…
code_buddy
  • 65
  • 2
  • 12
0
votes
2 answers

What is the correct build.gradle converters version for grails 4.0.10?

With my Grails 4.0.10 build my default JSON views throw a "NoSuchMethod" error with grails.core.GrailsDomainClass.getIdentifier()Lgrails/core/GrailsDomainClassProperty This error occurs from this simple Grails console example: import…
Jay
  • 173
  • 10
0
votes
0 answers

How do I call an API using (Spring) webClient with a @JsonView-filtered DTO?

I have dived into the documentation, but only find circular references to the mechanical aspects of the use of webCleint, without any concrete examples… And nothing that merges it with the use of @JsonView. I have a microservice that accepts a DTO…
Rick
  • 397
  • 3
  • 16
0
votes
1 answer

Show data in json view after injection in a matDailog (Angular 9+)

I need to show data in JSON view inside MatDialog. I am using an API to fetch some data and then injecting it into the dialog box using data option of MatDialog. Data is being injected successfully and also accessible in the dialog component. I'm…
ess.etch
  • 11
  • 3
0
votes
1 answer

react-json-view trims all white space from string

I use a "react-json-view" to display a json. The problem is, the library trims all white spaces in delivered strings. I have a data with valid json: { title: "some title end of title" } And I receive output in my json…
Italik
  • 696
  • 2
  • 18
  • 35
0
votes
1 answer

Grails JSON renderer not exposing model for Interceptor

I want to use the model field in an Interceptor for a JSON REST response. The controller method responds with the domain object: def show(String id) { respond User.get(id) } The JSON view uses JsonViewJsonRenderer which extends…
flicken
  • 15,443
  • 4
  • 29
  • 29
0
votes
0 answers

jackson reuse object ignoring some properties in rest request with java

Scenario: Im trying to reuse some properties of an existing dto to my Restful request. Given: com.fasterxml.jackson.annotation.*; //v2.9.0 Im trying to do that: class Parent { private String value; @JsonView(ChildView.Basic.class) private Child…
Matheus
  • 57
  • 1
  • 11
0
votes
2 answers

How to map different name to json property based on rest method per @JsonView in spring boot?

I have 2 set of rest APIs implemented using Spring boot using same Java POJO class. I have to return different fields and with different name for few fields, based on API. Presently I am using @JsonView for one set of API. But I also need to give…
A MJ
  • 115
  • 1
  • 9
0
votes
1 answer

Use of domain methods in Grails JSON View

I have created a Grails 4.0 application using the VUE profile and am using the JSON Views (http://views.grails.org/latest/#_json_views) and everything works correctly but I haven't found a way to use domain methods in the .gson template An example…
user779643
  • 37
  • 6