You can install the task via FRENDS UI Task view, by searching for packages. You can also download the latest NuGet package from https://www.myget.org/feed/frends/package/nuget/Frends.Json and import it manually via the Task view.
Requirements
NET Core SDK 2.1 or later
Clone a copy of the repo
git clone https://github.com/FrendsPlatform/Frends.Json.git
Restore dependencies
dotnet restore
Build the solution
dotnet build
Run Tests
dotnet test Frends.Json.Test
Create a nuget package
dotnet pack Frends.Json
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.
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
Query a json string / json token using JSONPath query.
Property | Type | Description | Example |
---|---|---|---|
Json | dynamic ( JToken / string ) | Json for the query. | {"key":"value"} |
Query | string | Query that uses JSONPath syntax. See http://goessner.net/articles/JsonPath/ for details | $.store.book[0].title $['store']['book'][0]['title'] |
Property | Type | Description |
---|---|---|
ErrorWhenNotMatched | bool | A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression. |
Array [ JToken ]
Query a json string / json token for a single result
Property | Type | Description | Example |
---|---|---|---|
Json | dynamic ( JToken / string ) | Json for the query. | {"key":"value"} |
Query | string | Query that uses JSONPath syntax. See http://goessner.net/articles/JsonPath/ for details | $.store.book[0].title $['store']['book'][0]['title'] |
Property | Type | Description |
---|---|---|
ErrorWhenNotMatched | bool | A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression. |
JToken
Handlebars provides the power necessary to let you build semantic templates effectively with no frustration. See https://github.com/rexm/Handlebars.Net
Property | Type | Description | Example |
---|---|---|---|
Json | dynamic ( JToken / string ) | Object used to fill the template | {"title":"mr.", "name":"foo"} |
HandlebarTemplate | string | Template for handlebars. This needs to be in expression mode. Using {{ }} in other modes breaks the task. | <xml> {{title}} {{> strongName}} </xml> |
HandlebarPartials | Array{string TemplateName, string Template} | Partials for a handlebars template. A partial is inicated by adding a {{'>' templateName }} inside the parent HandlebarTemplate | TemplateName: "strongName", Template: "<strong>{{name}}</strong>" |
string
Validate your json with Json.NET Schema. See http://www.newtonsoft.com/jsonschema
Property | Type | Description | Example |
---|---|---|---|
Json | dynamic ( JToken / string ) | Json to be validated | {"key":"value"} |
JsonSchema | string | JsonSchema to use for validation | {"type": "object", "properties": {"key": {"type":"string"} } } |
Property | Type | Description |
---|---|---|
IsValid | bool | Indicates if the json is valid |
Errors | List |
List of error messages for the validation |
Convert an XML string to JToken
Property | Type | Description |
---|---|---|
xml | string |
JToken
Convert an Json string to JToken
Property | Type | Description |
---|---|---|
json | string |
JToken
This project is licensed under the MIT License - see the LICENSE file for details