All Projects → Liuyis → jsonfilter

Liuyis / jsonfilter

Licence: other
A POJO property filter for Resful JSON output bases on fastjson and springboot.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to jsonfilter

Medusa
🐈Medusa是一个红队武器库平台,目前包括扫描功能(200+个漏洞)、XSS平台、协同平台、CVE监控等功能,持续开发中 http://medusa.ascotbe.com
Stars: ✭ 796 (+3216.67%)
Mutual labels:  fastjson
Sensitive
🔐Sensitive log tool for java, based on java annotation. (基于注解的 java 日志脱敏框架,更加优雅的日志打印)
Stars: ✭ 200 (+733.33%)
Mutual labels:  fastjson
table2pojo
Generate POJOs for database table/columns
Stars: ✭ 16 (-33.33%)
Mutual labels:  pojo
Rxcache
A local reactive cache for Java and Android. Now, it supports heap memory、off-heap memory and disk cache.
Stars: ✭ 102 (+325%)
Mutual labels:  fastjson
Jsontokotlinclass
🚀 Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )
Stars: ✭ 2,438 (+10058.33%)
Mutual labels:  fastjson
AwesomePojoGenerator
Intellij Plugin to generate Pojo class from json
Stars: ✭ 25 (+4.17%)
Mutual labels:  pojo
Fastjson
A fast JSON parser/generator for Java.
Stars: ✭ 23,997 (+99887.5%)
Mutual labels:  fastjson
QSHttp
Android安卓http/https一句代码联网络框架net framework
Stars: ✭ 14 (-41.67%)
Mutual labels:  fastjson
Gecco
Easy to use lightweight web crawler(易用的轻量化网络爬虫)
Stars: ✭ 2,310 (+9525%)
Mutual labels:  fastjson
bascomtask
Lightweight parallel Java tasks
Stars: ✭ 49 (+104.17%)
Mutual labels:  pojo
Apijson
🚀 零代码、热更新、全自动 ORM 库,后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构。 🚀 A JSON Transmission Protocol and an ORM Library for automatically providing APIs and Docs.
Stars: ✭ 12,559 (+52229.17%)
Mutual labels:  fastjson
Lzhpo Shiro
美观、漂亮,我抽离出来的,拿来即用的简单后台管理系统!
Stars: ✭ 170 (+608.33%)
Mutual labels:  fastjson
polymorphia
A very fast POJO codec for MongoDB (used in conjunction with the Mongo Java Driver) that handles generic types as well as polymorphic class hierarchies
Stars: ✭ 21 (-12.5%)
Mutual labels:  pojo
Easyjson
Provides an unified JSON access API, you can adapter any JSON library to Gson, Jackson, FastJson with easyjson。 提供了一个JSON门面库,就像slf4j一样。easyjson本身不做json的操作,完全依赖于底层实现库。可以直接使用Easyjson的API,底层的JSON库随时可切换。也可以使用其中某个json的API,然后通过easyjson适配给其他的json库
Stars: ✭ 54 (+125%)
Mutual labels:  fastjson
ksoup
Kotlin Wrapper for Jsoup
Stars: ✭ 59 (+145.83%)
Mutual labels:  pojo
Fastjsonexploit
Fastjson vulnerability quickly exploits the framework(fastjson漏洞快速利用框架)
Stars: ✭ 645 (+2587.5%)
Mutual labels:  fastjson
Datoji
A tiny JSON storage service. Create, Read, Update, Delete and Search JSON data.
Stars: ✭ 222 (+825%)
Mutual labels:  fastjson
nest-admin
NestJs CRUD for RESTful API使用 nestjs + mysql + typeorm + redis + jwt + swagger 企业中后台管理系统项目RBAC权限管理(细粒度到按钮)、实现单点登录等。
Stars: ✭ 165 (+587.5%)
Mutual labels:  resful-api
smpe-admin
SMPE-ADMIN后端通用开发框架
Stars: ✭ 42 (+75%)
Mutual labels:  fastjson
springboot-learning-demo
springboot学习示例
Stars: ✭ 17 (-29.17%)
Mutual labels:  fastjson

jsonfilter

A simple POJO property filter for Resful JSON output bases on fastjson and springboot.

Dependencies

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.5.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.46</version>
        </dependency>

Install

Add jsonfilter-1.0.4.jar to your project's dependencies. You can do like that in maven project:

        <dependency>
            <groupId>com.liuyis</groupId>
            <artifactId>jsonfilter</artifactId>
            <version>1.0.4</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/jsonfilter-1.0.4.jar</systemPath>
        </dependency>

Then, just enjoy it !

Example

customize a POJO json output

    @GetMapping("/user")
    //use annotation to customize your json output *_*
    //clazz -- the POJO class that you want to customize
    //includes -- the properties in POJO that you want to save
    @SerializeField(clazz = User.class,includes = {"name","id"})
    public User user() {
        User user = new User(1L, "liuyis", "123456");
        return user;
    }

you will get response like that : {"id":1,"name":"liuyis"}

customize two POJO json output

    @GetMapping("/user2")
    //use annotation to customize your json output *_*
    //clazz -- the POJO class that you want to customize
    //includes -- the properties in POJO that you want to save
    @SerializeField(clazz = User.class,includes = {"name", "id", "addresses"})
    //use @MultiSerializeField annotation to customize the second POJO json output *_*
    //clazz -- the POJO class that you want to customize
    //excludes -- the properties in POJO that you do not want to show in json output
    @MultiSerializeField(clazz = Address.class, excludes = {"user"})
    public User user2() {
        User user = new User(1L, "liuyis", "123456");
        List<Address> addresses = new ArrayList<>();
        Address a1 = new Address("liuyis's home", "liuyis's school", user);
        Address a2 = new Address("liuyis's home2", "liuyis's school2", user);
        addresses.add(a1);
        addresses.add(a2);
        user.setAddresses(addresses);

        return user;
    }

you will get response like that: {"addresses":[{"home":"liuyis's home","school":"liuyis's school"},{"home":"liuyis's home2","school":"liuyis's school2"}],"id":1,"name":"liuyis"}

    @GetMapping("/address")
    //use annotation to customize your json output *_*
    //clazz -- the POJO class that you want to customize
    //includes -- the properties in POJO that you wan to save
    @SerializeField(clazz = Address.class, includes = {"school", "home", "user"})
    //use @MultiSerializeField annotation to customize the second POJO json output *_*
    //clazz -- the POJO class that you want to customize
    //excludes -- the properties in POJO that you do not want to show in json output
    @MultiSerializeField(clazz = User.class, excludes = {"addresses"})
    public Address address(){
        User user = new User(1L, "liuyis", "123456");
        List<Address> addresses = new ArrayList<>();
        Address a1 = new Address("liuyis's home", "liuyis's school", user);
        Address a2 = new Address("liuyis's home2", "liuyis's school2", user);
        addresses.add(a1);
        addresses.add(a2);
        user.setAddresses(addresses);

        return a1;
    }

you will get response like that:{"home":"liuyis's home","school":"liuyis's school","user":{"id":1,"name":"liuyis"}}

customize mutiple POJO json output

    @GetMapping("/address2")
    //use @MoreSerializeField annotation to customize mutiple POJO json output *_*
    //add @SerializeField annotation as many as you want :)
    @MoreSerializeField({
            @SerializeField(clazz = Address.class,includes = {"school", "home", "user"}),
            @SerializeField(clazz = User.class, includes = {"id", "name"})})
    public Address address2(){
        User user = new User(1L, "liuyis", "123456");
        List<Address> addresses = new ArrayList<>();
        Address a1 = new Address("liuyis's home", "liuyis's school", user);
        Address a2 = new Address("liuyis's home2", "liuyis's school2", user);
        addresses.add(a1);
        addresses.add(a2);
        user.setAddresses(addresses);

        return a1;
    }

you will get response like that:{"home":"liuyis's home","school":"liuyis's school","user":{"id":1,"name":"liuyis"}}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].