GRASS GSoC 2025 Add JSON output to different tools in C
Student Name | Nishant Bansal |
Organization | OSGeo - Open Source Geospatial Foundation |
Mentor Name | Anna Petrasova, Corey White, Vaclav Petras |
GitHub Fork | View Repo |
GSoC proposal | View Proposal |
Abstract
Currently, most GRASS tools produce data in plain text by default. This means that users who want to process the output in Python need to create custom parsing code. To make this easier, several modules could be improved by offering JSON as an alternative output format. Recently, the Parson library was added to the GRASS codebase to support JSON output in addition to plain text. Building on the advancements made during the last GSoC, my project aims to expand JSON output capabilities to more tools using the Parson library.
Goal
- Working with mentors to finalize the structure of the JSON output.
- Adding an option to choose the output format (plain text or JSON) for each updated tool.
- Developing Python test cases to ensure that the JSON output works correctly and to avoid future issues.
- Providing basic documentation and example JSON outputs for each modified tool.
- Develop simple examples demonstrating how to use JSON output in a data science workflow, such as reading JSON data into pandas or python.
Timeline
Period | Timeline | Tasks | Status |
---|---|---|---|
Bonding Period |
May 8 - June 1 |
|
OK |
Official Coding Period | |||
Week 1 (June 2 - June 8) |
OK | ||
Week 2 (June 9 - June 15) |
OK | ||
Week 3 (June 16 - June 22) |
OK | ||
Week 4 (June 23 - June 29) |
OK | ||
Week 5 (June 30 - July 6) |
OK | ||
Week 6 (July 7 - July 13) |
OK | ||
Week 7 (July 14 - July 20) | |||
Week 8 (July 21 - July 27) | |||
Week 9 (July 28 - August 3) | |||
Week 10 (August 4 - August 10) | |||
Week 11 (August 11 - August 17) | |||
Week 12 (August 18 - August 24) | |||
Evaluation Period | |||
August 25 - September 1 |
Reports
Community Bonding Period
What did I get done this week?
- Introduced myself on the OSGeo Discourse mailing list.
- Created both my personal Wiki page and the project Wiki page, adding all necessary project-related information.
- Read GRASS documentation to support the addition of Python and JSON examples.
- Worked on the following pull requests:
What do I plan on doing next week?
- Add JSON output support to the g.mapset and r.what.color modules.
- If time permits, I will begin improving the r.info interface: Issue #5793
Am I blocked on anything?
- No, I am not currently blocked on anything.
Project Discussions and Meetings
- 14 May 2025: Introductory meeting discussing JSON support and overall project milestones.
- 21 May 2025: Introduction with fellow developers. Discussed priority tools, adding Python/Pandas examples, and approaches for finalizing the JSON schema for each module.
Week-1
What did I get done this week?
- g.mapset: Added JSON output support, now you can use -p and -l flags to get JSON-formatted results.
- r.univar: Fixed a bug causing an uninitialized zone_value.
- r.what.color: Implemented JSON output support. (See PR #5822)
- r.info (regression tests): To maintain backward compatibility while updating its interface, I added strong regression tests.
- r.info (interface improvements): Began improving the module’s interface. (See PR #5859)
What do I plan on doing next week?
- Address review comments on my open PRs.
- Add JSON output support to g.version (see issue #5816).
- Add JSON output support to i.group (see issue #5815).
- If time permits, write tests for r.stats (see issue #5814).
Am I blocked on anything?
- No, I am not currently blocked on anything.
Week-2
What did I get done this week?
- g.version: Implemented JSON output support. (See PR #5863)
- i.group: Implemented JSON output support. (See PR #5870)
- r.stats (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- r.stats: Added tests for JSON output; this uncovered a bug, which was fixed alongside.
What do I plan on doing next week?
- Address review comments on my open PRs.
- Update JSON output format of v.distance (see issue #5846).
- Add JSON output support to g.list (see issue #5848).
- If time permits, fix the JSON output format of g.region (see issue #5828).
Am I blocked on anything?
- No, I am not currently blocked on anything.
Week-3
What did I get done this week?
- v.distance: Updated the JSON output schema. (See PR #5898)
- r.stats: Fixed a bug causing an uninitialized
window
variable. - g.list (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- g.list: Implemented JSON output support. (See PR #5921)
- g.region: Updated the JSON output schema. (See PR #5929)
What do I plan on doing next week?
- Address review comments on my open PRs.
- Update JSON output format of v.to.db (see issue #5711).
- Update JSON output format and documentation of r.profile (see issue #5834).
- If time permits, add shell and csv output formats to r.univar (see issue #5824).
Am I blocked on anything?
- No, I am not currently blocked on anything.
Week-4
What did I get done this week?
- v.to.db: Updated the JSON output schema. (See PR #5946)
- r.profile: Updated the JSON output schema. (See PR #5962)
- r.univar: Implemented SHELL and CSV output support. (See PR #5966)
What do I plan on doing next week?
- Add JSON output support to r.regression.line (see issue #5950).
- Add JSON output support to r.stats.quantile (see issue #5951).
- Add JSON output support to r.volume (see issue #5949).
Am I blocked on anything?
- No, I am not currently blocked on anything.
Week-5
What did I get done this week?
- r.regression.line (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- r.regression.line: Implemented JSON output support. (See PR #5993)
- r.stats.quantile (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- r.stats.quantile: Implemented JSON output support. (See PR #6007)
- r.volume (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- r.volume: Implemented JSON output support. (See PR #6036)
What do I plan on doing next week?
- Add JSON output support to m.measure (see issue #6006).
- Add JSON output support to db.columns (see issue #6008).
- Add JSON output support to db.connect (see issue #6009).
Am I blocked on anything?
- No, I am not currently blocked on anything.
Week-6
What did I get done this week?
- db.columns: Implemented JSON output support. (See PR #6042)
- m.measure (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- db.connect (regression tests): To maintain backward compatibility while adding JSON format, I added strong regression tests.
- m.measure: Implemented JSON output support. (See PR #6053)
What do I plan on doing next week?
Am I blocked on anything?
- No, I am not currently blocked on anything.
Log of Pull Requests
Below is a list of pull requests submitted to the GRASS repository during GSoC 2025:
Pull Request | Description | Date | Status |
---|---|---|---|
#5688 | r.univar: Fix JSON structure | May 20, 2025 | Merged |
#5773 | r.what.color: Add test file | May 25, 2025 | Merged |
#5775 | g.mapset: Add test file | May 26, 2025 | Merged |
#5784 | r.info: Add Python example | May 28, 2025 | Closed |
#5785 | g.region: Add Python example | May 28, 2025 | Merged |
#5810 | g.mapset: Add JSON support | June 2, 2025 | Merged |
#5821 | r.univar: Fix uninitialized zone_value | June 3, 2025 | Merged |
#5822 | r.what.color: Add JSON support | June 3, 2025 | Merged |
#5842 | r.info: Update test file | June 5, 2025 | Merged |
#5859 | r.info: Improve interface | June 7, 2025 | Merged |
#5863 | g.version: Add JSON support | June 9, 2025 | Merged |
#5870 | i.group: Add JSON support | June 10, 2025 | Merged |
#5879 | r.stats: Add test file | June 12, 2025 | Merged |
#5892 | r.stats: Add tests for JSON output | June 14, 2025 | Merged |
#5898 | v.distance: Update JSON format | June 16, 2025 | Merged |
#5900 | r.stats: fix uninitialised window value | June 17, 2025 | Merged |
#5906 | g.list: Add test file | June 17, 2025 | Merged |
#5921 | g.list: Add JSON support | June 20, 2025 | Merged |
#5929 | g.region: Update JSON format | June 21, 2025 | Merged |
#5946 | v.to.db: Update JSON format | June 23, 2025 | Merged |
#5962 | r.profile: Update JSON format | June 25, 2025 | Merged |
#5966 | r.univar: Add shell and CSV format | June 25, 2025 | Merged |
#5990 | r.regression.line: Add test file | June 30, 2025 | Merged |
#5993 | r.regression.line: Add JSON support | June 30, 2025 | Merged |
#6002 | r.stats.quantile: Add test file | July 1, 2025 | Merged |
#6007 | r.stats.quantile: Add JSON support | July 1, 2025 | Merged |
#6027 | r.volume: Add test file | July 4, 2025 | Merged |
#6036 | r.volume: Add JSON support | July 6, 2025 | Merged |
#6042 | db.columns: Add JSON support | July 7, 2025 | Open |
#6051 | m.measure: Add test file | July 10, 2025 | Merged |
#6052 | db.connect: Add test file | July 10, 2025 | Open |
#6053 | m.measure: Add JSON support | July 11, 2025 | Open |