GitHub Action to filter JSON files by provided fields and operation mode (unique/duplicate)
- Description
- Inputs
- Outputs
- Examples
- Visitor stats
- Licensing
- Authors
- Versioning
- Contribution
- Acknowledgement
- Forks
- Development Support
Processes JSON file by provided list of fields and file source parameters.
Optional JSON data source file with action parameters:
[
{
"sourceFile": "./data/african_proverbs.json",
"targetPath": "./data",
"targetFile": "african_proverbs_unique.json",
"mode": "unique",
"jsonPath": "$.african[*]",
"jsonFields": [
"text"
]
},
{
"sourceFile": "./data/gypsy_proverbs.json",
"targetPath": "./data",
"targetFile": "gypsy_proverbs_unique.json",
"mode": "unique",
"jsonPath": "$.gypsy[*]",
"jsonFields": [
"text"
]
}
]
[
{
"sourceFile": "./data/african_proverbs.json",
"targetPath": "./data",
"mode": "unique",
"jsonPath": "$.african[*]",
"jsonFields": [
"text"
]
},
{
"sourceFile": "./data/gypsy_proverbs.json",
"targetPath": "./data",
"mode": "unique",
"jsonPath": "$.gypsy[*]",
"jsonFields": [
"text"
]
}
]
Required JSON operation mode
Only unique fields must be processed
Only duplicate fields must be processed
Required String representing JSON query path ($.property1.property2)
More information on JSON path queries can be found at jsonpath
Optional String representing comma-separated list of fields to process (field1,field2,...,fieldN)
Required Source JSON file to process
Required Target path to store processed JSON file
Optional Target JSON destination file name (default sourceFile)
JSON processing operation status
When JSON source file successfully processed and results stored to destination folder
When error occurred while processing JSON source file
- name: Process JSON file by fields
uses: alexrogalskiy/github-action-json-fields@master
with:
mode: 'unique'
jsonPath: 'african'
jsonFields: 'text'
sourceFile: ./data/african_proverbs.json
targetPath: ./data
targetFile: african_proverbs_unique.json
Running locally:
npm run start:action --action github-action-json-fields --mode 'unique' --jsonPath 'african' --jsonFields 'text' --sourceFile './data/african_proverbs.json' --targetPath './data' --targetFile 'african_proverbs_unique.json'
Json Fields is distributed under LGPL version 3 or later, [License]. LGPLv3 is additional permissions on top of GPLv3.
Json Fields is maintained by the following GitHub team-members:
with community support please contact with us if you have some question or proposition.
The project uses SemVer for versioning. For the versions available, see the tags on this repository.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us (emoji key).
This project follows the all-contributors specification. Contributions of any kind are welcome!
See also the list of contributors who participated in this project.
Like Json Fields ? Consider buying me a coffee :)