{"id":24491463,"url":"https://github.com/tomlm/jsontemplates","last_synced_at":"2026-05-17T17:08:00.221Z","repository":{"id":98758182,"uuid":"94268225","full_name":"tomlm/JsonTemplates","owner":"tomlm","description":"Library for data binding a object with a JSON template to create JSON output","archived":false,"fork":false,"pushed_at":"2017-06-13T23:49:32.000Z","size":274,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-02T19:42:19.943Z","etag":null,"topics":["json","template"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomlm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-06-13T23:42:52.000Z","updated_at":"2019-03-15T16:31:12.000Z","dependencies_parsed_at":"2023-04-24T01:01:45.285Z","dependency_job_id":null,"html_url":"https://github.com/tomlm/JsonTemplates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomlm/JsonTemplates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlm%2FJsonTemplates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlm%2FJsonTemplates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlm%2FJsonTemplates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlm%2FJsonTemplates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomlm","download_url":"https://codeload.github.com/tomlm/JsonTemplates/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlm%2FJsonTemplates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33147340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","template"],"created_at":"2025-01-21T18:18:13.955Z","updated_at":"2026-05-17T17:08:00.216Z","avatar_url":"https://github.com/tomlm.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Json Templates\nSimple Json transformation tool to bind Json data objects to a complex Json structure.\n\n# Binding\nThe template is expressed in terms of a JSON object where the values are bound using JPath (http://goessner.net/articles/JsonPath/). \n\n**Value Binding** \n\nA property value with **{=Path}** will use JPath to bind to a property and output the native value of the property\n\n**String Binding**\n\nA property with **{ Path }** will use JPath to bind to a property and output the *string* value of the property.\n\nYou can specify multiple string bindings in one string to make *compound string*.\n\n\u003e Example:\n\u003e\n\u003e \"Your first name is: *{ firstName }* and last name is: *{ lastName }*\"\n\u003e \n\u003e Becomes\n\u003e \n\u003e \"Your first name is: Tom and last name is: Laird-McConnell\"\n\nYou can control the string that is generated using the **Format(path, formatCode)** function, \nwhere the formatCode is the .NET format string for .ToString(formatCode).  \n\n\u003e Example:\n\u003e \n\u003e \"Date your document created:{ format(path,D) }\"\n\u003e \n\u003e Becomes:\n\u003e \n\u003e \"Date your document created: Thursday, January 12, 2017\"\n\u003e \n\n\n**Array Item Binding**\n\nYou can bind to an array of items and define a template that applies to each element.  You do this by specifying the JPath in the\nproperty name like so:\n\nExample:\n\n    \"items={path}\" : [\n        {\n            \"prop\":\"{=someValue}\" \n        }\n    ]\n   \n## Usage\n    JsonTemplate template = new JsonTemplate(jsonTemplate);\n    dynamic result = template.Bind(source);\n\n\u003e You can call template.Bind() as much as you want and it is thread safe.  \n\n\n#### Example Data:\n\n    {\n      \"aStr\": \"A String\",\n      \"aNumber\": 13,\n      \"aDatetime\": \"2017-01-12T08:28:48.0473306-08:00\",\n      \"aBoolean\": true,\n      \"aObject\": {\n        \"X\": \"XValue\",\n        \"Y\": 99\n      },\n      \"foo\": {\n        \"bar\": [\n          {\n            \"Name\": \"Item1\",\n            \"Rating\": 1,\n            \"subObject\": {\n              \"x\": 11\n            }\n          },\n          {\n            \"Name\": \"Item2\",\n            \"Rating\": 2,\n            \"subObject\": {\n              \"x\": 22\n            }\n          },\n          {\n            \"Name\": \"Item3\",\n            \"Rating\": 3,\n            \"subObject\": {\n              \"x\": 33\n            }\n          }\n        ]\n      }\n    }\n\n#### Example Template:\n\n    {\n        \"stringBinding\": \"{=aStr}\",\n        \"compoundBinding\": \"This is a {aStr} an so is {foo.bar[2].Name}!\",\n        \"joinSimple\": \"This is a {foo.bar[*].Name}!\",\n        \"boolStringBinding\": \"{aBoolean}\",\n        \"boolBinding\": \"{=aBoolean}\",\n        \"numberStringBinding\": \"{aNumber}\",\n        \"numberBinding\": \"{=aNnumber}\",\n        \"noBinding\": \"This should pass through unchanged\",\n        \"dateBinding\": \"{=aDateTime}\",\n        \"dateStringBinding\": \"{aDateTime}\",\n        \"formatBinding\": \"{format(aDateTime,D)}\",\n        \"subObjectBinding\": {\n            \"title\": \"{foo.bar[1].Name}\"\n        },\n        \"simpleArray\": \"{=foo.bar[*].Name}\",\n        \"myArray={foo.bar}\": [\n            {\n                \"num\": \"{Rating}\",\n                \"metadata\": {\n                    \"title\": \"{Name}: {subObject.x}\"\n                }\n            }\n        ]\n    }\n\n\n#### Example output\n\n    {\n        \"stringBinding\": \"A String\",\n        \"compoundBinding\": \"This is a A String an so is Item3!\",\n        \"joinSimple\": \"This is a Item1, Item2, Item3!\",\n        \"boolStringBinding\": \"True\",\n        \"boolBinding\": true,\n        \"numberStringBinding\": \"13\",\n        \"numberBinding\": 13,\n        \"noBinding\": \"This should pass through unchanged\",\n        \"dateBinding\": \"2017-01-12T08:28:48.0473306-08:00\",\n        \"dateStringBinding\": \"1/12/2017 8:28:48 AM\",\n        \"formatBinding\": \"Thursday, January 12, 2017\",\n        \"subObjectBinding\": {\n            \"title\": \"Item2\"\n        },\n        \"simpleArray\": [\n            \"Item1\",\n            \"Item2\",\n            \"Item3\"\n        ],\n        \"myArray\": [\n            {\n                \"num\": \"1\",\n                \"metadata\": {\n                    \"title\": \"Item1: 11\"\n                }\n            },\n            {\n                \"num\": \"2\",\n                \"metadata\": {\n                    \"title\": \"Item2: 22\"\n                }\n            },\n            {\n                \"num\": \"3\",\n                \"metadata\": {\n                    \"title\": \"Item3: 33\"\n                }\n            }\n        ]\n    }","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomlm%2Fjsontemplates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomlm%2Fjsontemplates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomlm%2Fjsontemplates/lists"}