---
title: Output Encoding For Dynamic JS/JSON
impact: HIGH
impactDescription: prevents injection in JavaScript contexts
tags: xss, python, json, encoding, security
---

## Output Encoding For Dynamic JS/JSON

This rule ensures high quality and security in Python and PySpark applications.

**Implementation Guidance:**
- Follow standard Python best practices (PEP 8)
- Use type hints for better clarity
- For PySpark, prefer DataFrame API over SQL strings where possible
- Ensure proper resource management (using \`with\` statements)
