Skip to content

Add json_to_string usage example#776

Open
ZGT23 wants to merge 1 commit into
thoth-tech:mainfrom
ZGT23:feature/json-to-string-usage-example
Open

Add json_to_string usage example#776
ZGT23 wants to merge 1 commit into
thoth-tech:mainfrom
ZGT23:feature/json-to-string-usage-example

Conversation

@ZGT23
Copy link
Copy Markdown

@ZGT23 ZGT23 commented May 17, 2026

Description

Splashkit Function: json_to_string

Overview of example functionality:
This pull request adds a beginner-friendly usage example for the json_to_string function in the Json category.

The example creates a Json object from a valid JSON string using json_from_string(), then converts the Json object back into a readable string using json_to_string(). The original JSON string and converted output are printed to the terminal so beginners can clearly see what the function returns.

This example helps users understand how SplashKit Json objects can be converted into text for display, debugging, or saving.

Files Included

  • C++ code
  • C# code (Top-Level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Relevant title for the example (.txt)
  • Screenshot

Usage Example Checks

  • Code uses the SplashKit function above
  • Code does not use non-SplashKit functions
  • Code does not use extra function declarations or extra classes
  • Simple, clear demonstration of the function
  • Tested C++ version locally in MSYS2
  • Tested Python version locally in MSYS2

How Has This Been Tested?

The example was tested locally to confirm that:

  • The Json object is created successfully from a valid JSON string
  • json_to_string() converts the Json object into a readable string
  • The original and converted strings are printed correctly
  • C++ version runs correctly in MSYS2
  • Python version runs correctly in MSYS2

Testing Checklist

  • C++ example tested locally
  • Python example tested locally
  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run preview

Folders and Files Added/Modified

  • Added:
    • public/usage-examples/json/json_to_string-1-example.cpp
    • public/usage-examples/json/json_to_string-1-example-top-level.cs
    • public/usage-examples/json/json_to_string-1-example-oop.cs
    • public/usage-examples/json/json_to_string-1-example.py
    • public/usage-examples/json/json_to_string-1-example.txt
    • public/usage-examples/json/json_to_string-1-example.png

Additional Notes

This example is designed to be simple and beginner-friendly. It focuses on demonstrating how json_to_string() converts a SplashKit Json object into a string without adding unnecessary complexity.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 44a6500
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a098b3a86ac7f00093c302b

Copy link
Copy Markdown

@RUNQILIU-123 RUNQILIU-123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. This is a clear and beginner-friendly usage example for json_to_string. The example demonstrates the function well by converting a Json object back into a readable string, and the output is easy for beginners to understand. The added C++, C#, Python, title, and screenshot files are consistent with the expected usage example format. Good work.

Copy link
Copy Markdown

@rachelpatrao rachelpatrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code and example implementation look good overall and everything appears to be working correctly.
One thing still needed is registering the new usage example in scripts/json-files/usage-example-references.json so it can be properly referenced and displayed in the documentation site. Once thats sorted it should be ready to approve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants