# Run2 Scala Circe JSON

> Using circe for JSON tokenization in Scala, including printing, cursor navigation, and path-based access.

- Skill: `cxcscmu/run2-scala-circe-json` (Agent Skill)
- Install (CLI): `npx get-skill add cxcscmu/run2-scala-circe-json`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cxcscmu/run2-scala-circe-json/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: cxcscmu (https://skillmd.com/u/cxcscmu)
- Updated: 2026-11-24
- Page: https://skillmd.com/skills/cxcscmu/run2-scala-circe-json

---


# Circe JSON for Tokenization

## Printing
```scala
import io.circe.{Json, Printer}

val compact = Printer.noSpaces.print(json)
val pretty = Printer.spaces2.print(json)
```

## Path-Based Navigation with ACursor
```scala
import io.circe.ACursor

def navigate(json: Json, path: String): Option[Json] = {
  val cursor = path.split("\\.").foldLeft(json.hcursor: ACursor) { (c, part) =>
    if (part.forall(_.isDigit)) c.downN(part.toInt)
    else c.downField(part)
  }
  cursor.focus
}
```

## Key Differences from Python json module
- circe uses `Json` ADT instead of Python's dynamic types
- No need for recursive `JsonValue` type alias - `Json` is already recursive
- Printing via `Printer` instances rather than `json.dumps` kwargs

