Giter VIP home page Giter VIP logo

springboot-rest-api-filtering's Introduction

Filtering API

This API demonstrates how to perform filtering on JSON responses in Spring Boot using both static and dynamic serialization.

Static Filtering

Static filtering involves excluding certain fields from the JSON response at either the class level or the field level. This means that these fields will always be excluded from the JSON serialization, regardless of the context.

Class-level Static Filtering

At the class level, static filtering can be applied using Jackson's @JsonIgnoreProperties annotation. This annotation allows you to specify fields to be ignored during serialization for all instances of the class.

Field-level Static Filtering

At the field level, static filtering can be applied using Jackson's @JsonIgnore annotation. This annotation allows you to specify individual fields to be ignored during serialization.

Note:

Make sure to uncomment the @JsonIgnoreProperties or @JsonIgnore annotations as needed in the Student class to apply the desired static filtering behavior.

Dynamic Filtering

Dynamic filtering involves excluding certain fields from the JSON response based on runtime conditions. This allows for more flexibility as filtering can be applied selectively based on the request or other factors.

Endpoints

/filtering

  • GET request to this endpoint returns a single Student object with filtering applied.
  • Filtering is applied to include only the "name" and "city" fields in the response.

/filtering-list

  • GET request to this endpoint returns a list of Student objects with filtering applied.
  • Filtering is applied to include only the "name" and "mobile" fields in the response.

This README provides detailed explanations of both static and dynamic filtering mechanisms in the API and how to use the provided endpoints. Adjust the content as needed for your specific project documentation.

springboot-rest-api-filtering's People

Contributors

paras2322 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.