One solution to map entities/properties from one JSON to another with a different structure is to use a tool or library that supports mapping, such as AutoMapper. AutoMapper is a widely used open-source library for .NET that enables object-object mapping. You can define mapping configurations in code, such as property names, and use them to map between different object types. It supports complex object graphs and collections, and also supports custom mapping logic.
Another approach is to use a configuration-based mapping tool like FRENDS Mapper. FRENDS Mapper is an integration platform that provides a visual editor for creating and managing data mappings between different formats, such as JSON, XML, CSV, and SQL. With FRENDS Mapper, you can define mapping rules and transformations using a graphical user interface, and store them in a configuration file. This approach allows you to easily modify mappings without changing code or making database changes.
Regarding the use of the database to store mapping configurations, this is a good approach as it allows you to separate the mapping logic from the application code and provides a more flexible solution. You can define the mapping rules and configurations in a database table and retrieve them at runtime, then use them to dynamically map the objects. This approach allows you to modify the mapping configurations without redeploying the application. However, it requires careful design and management of the database table to ensure scalability, maintainability, and security.
In summary, there are several tools and approaches that you can use to map entities/properties from one JSON to another with a different structure. AutoMapper and FRENDS Mapper are two examples of tools that you can use, while storing mapping configurations in a database is a good practice that can improve flexibility and maintainability.