llm-json-parser

llm-json-parser is a skill for Claude Code, Codex from nongjun/feishu-cursor-claw. It costs 51 tokens per session (353 once invoked), scanned A, original, MIT.

A utility for extracting JSON from AI replies that may contain thinking sections, Markdown code blocks, or ordinary text around the data.

In plain words
What is it for?
Use it when an AI service must parse structured JSON from mixed natural-language responses or safely return a default when parsing fails.
Why use it?
It handles common response wrappers that make direct JSON parsing fail, while reporting extracted thinking text separately.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nongjun/feishu-cursor-claw/llm-json-parser
Any agent
npx skills add nongjun/feishu-cursor-claw --skill llm-json-parser
Clone the repo
git clone --depth 1 https://github.com/nongjun/feishu-cursor-claw

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for llm-json-parser

README.md
[![agentmods](https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/llm-json-parser.svg)](https://agentmods.dev/skills/nongjun/feishu-cursor-claw/llm-json-parser)
Your own site
<a href="https://agentmods.dev/skills/nongjun/feishu-cursor-claw/llm-json-parser"><img src="https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/llm-json-parser.svg" alt="Measured on agentmods" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 353 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.00353
Opus 5 $0.00026 $0.00177
Sonnet 5 $0.00010 $0.00071
Haiku 4.5 $0.00005 $0.00035

Measured 6d ago against content hash 6a8edcdd6724, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

llm-json-parser scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

参考代码/njcursor/skills/llm-json-parser/SKILL.md · 45 lines

What it actually says

LLM JSON 解析

当前实现

位于 AIService 内部,使用正则表达式提取(非 json-repair 库)。

关键函数

函数 用途
parse_ai_json_response(content) 提取并解析 JSON,返回 (dict, thinking_text)
safe_parse_ai_json(content, default) 带默认值的安全解析

处理流程

  1. 提取并移除 thinking 标签内容
  2. 识别 Markdown 代码块(json 或无标记)
  3. 从混合文本中用正则提取 JSON 对象
  4. 标准 json.loads() 解析

适用场景

  • AI 回复包裹在 thinking 标签中
  • AI 回复被 Markdown 代码块包裹
  • AI 回复中混有自然语言和 JSON

重点关注

  • 当前实现不使用 json-repair 库,仅做正则提取
  • 对于中文标点、未闭合引号等格式问题暂无自动修复
  • 如需更强容错能力,可引入 json-repair 库增强

导入路径

shared_backend.services.ai_service 中导出 parse_ai_json_responsesafe_parse_ai_json

参考文件

  • 公共模块/shared_backend/services/ai_service.py
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 45 lines · 51 tokens per session scan A 6a8edcdd6724

Subscribe to this mod's changes

llm-json-parser is a skill published in the GitHub repository nongjun/feishu-cursor-claw (14 stars, last pushed 1mo ago), licensed MIT. It adds 51 tokens to every session and 353 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

firebase-ai

Use when setting up firebaseai, generating text/chat with Gemini, streaming AI output, building multimodal prompts, or handling AI errors.

evanca/flutter-ai-rules · 30 tokens

audit-langfuse-llm

Run a PDCA quality audit on LLM/AI features: traces, prompts, costs, evals, grounding, hallucination. Use for "audit LLM quality", "check Langfuse", "audit prompts", "check AI quality", "audit AI costs", "check traces". Jailbreak/OWASP LLM → audit-llm-security. Token caps → plan-llm-cost-guardrails.

kensaurus/cursor-kenji · 93 tokens

data-pipeline

Wire ETL, ingestion, cron, edge-function, and queue jobs correctly. Use for "build a pipeline", "sync X into Y", "nightly aggregation", "cron double-counts", "dedupe", "backfill", "the numbers are wrong after a retry". Bakes in idempotency, atomic writes, data contracts, dead-letter, and observability.

kensaurus/cursor-kenji · 81 tokens

plan-llm-cost-guardrails

Audit an LLM-powered app for runaway-cost and quota-abuse exposure, then produce a phased guardrail plan. Use when the user says "cap my AI costs", "my LLM bill could blow up", "rate limit my AI", "token budget", "runaway agent loop", or is hardening LLM features before launch.

kensaurus/cursor-kenji · 78 tokens

audit-llm-security

Read-only OWASP LLM Top 10 audit of app-facing AI: prompt injection, data leakage, unsafe output/agency, RAG risks, misinformation, and unbounded spend. Use when "audit LLM security", "prompt injection", "jailbreak my chatbot", or "is my AI safe?". General app security → audit-security.

kensaurus/cursor-kenji · 76 tokens

langchain-workflow-builder

Builds LLM applications with LangChain including chains, agents, memory, tools, and RAG pipelines. Use when users request "LangChain setup", "LLM chain", "AI workflow", "conversational AI", or "RAG pipeline".

patricio0312rev/skills · 58 tokens