Falling in love with json(net) by Jakub Marchwicki

Discover how JSON.NET solves common JSON pain points with templating, validation & reusability. Learn best practices for infrastructure config & monitoring setup.

Key takeaways
  • JSON.NET is a library that helps manage and template JSON files, particularly useful for infrastructure-as-code scenarios

  • Common JSON pain points include:

    • Lack of variables and reusability
    • No multi-line string support
    • Copy-pasting blocks of similar configuration
    • No built-in validation
    • No commenting capability
  • JSON.NET provides key features:

    • Variable support and templating
    • Functions and logical validation
    • Standard library with common operations
    • Ability to import/reference other JSON files
    • Testing capabilities through a unit test library
  • Real-world applications include:

    • AWS CloudWatch dashboards
    • Infrastructure configuration
    • Application monitoring setup
    • Cross-service metrics and alarms
  • Best practices with JSON.NET:

    • Define top-level arguments for reusability
    • Create templates for common patterns
    • Build validation into templates
    • Use functions to encapsulate complex logic
    • Keep configurations DRY (Don’t Repeat Yourself)
  • JSON.NET transpiles to standard JSON, making it compatible with existing tools and services while providing better maintainability

  • The tool addresses the gap between JSON as a data interchange format and its use as a configuration language