This repository has been archived and the task has been moved to https://github.com/CommunityHiQ/Frends.Community.JSON
Json message mapper Task for FRENDS.
You can install the task via FRENDS UI Task View or you can find the nuget package from the following nuget feed 'Nuget feed coming at later date'
The JsonMapper task is meant for simple JSON to JSON transformation using JUST.net library. It can also be used for JSON to XML or CSV transformation, but it is not recommeded.
Input JSON is validated before actual transformation is executed. If input is invalid or transformation fails, an exception is thrown.
| Property | Type | Description | Example |
|---|---|---|---|
| Input Json | Object | Source Json to transform. Has to be String or JToken type | {"firstName": "Jane", "lastName": "Doe" } |
| Json Map | string | JUST transformation code. See JUST.Net documentaion for details of usage | {"fullName": "#xconcat(#valueof($.firstName), ,#valueof($.lastName))"} |
| Property | Type | Description | Example |
|---|---|---|---|
| Result | string | Contains transformation result. | { "fullName" : "Jane Doe" } |
| ToJson() | JToken | Method that returns Result string as JToken type. |
Simple example of combining two values from source JSON:
Input Json:
{
"firstName": "John",
"lastName": "Doe"
}Json Map:
{
"Name": "#xconcat(#valueof($.firstName), ,#valueof($.lastName))"
}Transformation result:
{
"Name": "John Doe"
}Json which root node is of type array does not work. It has to wrapped around an object. Example:
Input
[{
"Name": "John Doe"
},
{
"Name": "John Doe"
}]with Json Map
{
"Name": "#valueof($.[0].firstName)"
}throws exception in transformation. This can be avoided by wrapping Input Json as follows:
{ "root":
[{
"Name": "John Doe"
},
{
"Name": "John Doe"
}]
}This project is licensed under the MIT License - see the LICENSE file for details
WorkMaze/JUST.net is licensed under the MIT License - see the LICENSE file for details
Clone a copy of the repo
git clone https://github.com/CommunityHiQ/Frends.Community.JsonMapper.git
Restore dependencies
nuget restore frends.community.jsonmapper
Rebuild the project
Run Tests with nunit3. Tests can be found under
Frends.Community.JsonMapper.Tests\bin\Release\Frends.Community.JsonMapper.Tests.dll
Create a nuget package
nuget pack nuspec/Frends.Community.JsonMapper.nuspec
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
| Version | Changes |
|---|---|
| 1.0.0 | Initial version of Task |