§

Convert ചെയ്യാൻ JSON അല്ലെങ്കിൽ YAML paste ചെയ്യുക.

ദിശ
ഇൻഡന്റ്
ഓപ്ഷനുകൾ
§

ഔട്ട്‌പുട്ട്

yaml

JSON, YAML ഇടയ്ക്ക് hop ചെയ്യൽ Kerala platform teams-ന് ദൈനംദിന ജോലി. Kubernetes manifests YAML-ൽ author ചെയ്‌ത് internally JSON ആക്കി process ചെയ്യുന്നു; GitHub Actions workflow YAMLs, OpenAPI 3 specifications, AWS CloudFormation templates, dbt `profiles.yml` — code review-ൽ ഇരുരൂപങ്ങൾക്കും ഇടയ്ക്ക് bend ആകേണ്ടി വരുന്നു. Helm chart YAML JSON-ലേക്ക് convert ചെയ്‌ത് Ajv pipeline-ൽ schema validate ചെയ്‌ത് deploy. ഈ ടൂൾ ഡേറ്റ ബ്രൗസറിൽ process ചെയ്‌ത് Kubernetes secrets, proprietary configs ഒരിക്കലും server-ൽ reach ആകില്ല.

JSON ↔ YAML conversion എന്നത് എന്താണ്?

JSON (JavaScript Object Notation, RFC 8259) structured data-ന് ഒരു strict, brace-delimited text format ആണ്; YAML (YAML Ain't Markup Language, version 1.2) indentation, line breaks, human-readable syntax ഉൾക്കൊണ്ട് JSON-ന്റെ superset ആണ്. ഇവ convert ചെയ്‌ത് ഒരേ configuration machine-friendly form (JSON for APIs, schema validation) ആകുകയും human-friendly form (YAML for code review, Kubernetes manifests) ആകുകയും ചെയ്യാം.

JSON ↔ YAML conversion എങ്ങനെ പ്രവർത്തിക്കുന്നു?

ഓരോ conversion-ഉം bundled js-yaml library (MIT, version 4.1.0) ഉൾക്കൊണ്ട് ബ്രൗസറിൽ locally run ആകുന്നു. High-level steps:

  1. Mode selector (Auto-detect / JSON → YAML / YAML → JSON) ഏത് pipeline run ആകണം എന്ന് decide ചെയ്യുന്നു. Auto-detect-ൽ ഇൻപുട്ടിന്റെ ആദ്യ non-whitespace character direction pick ചെയ്യുന്നു — {/[ JSON; മറ്റേതും YAML.
  2. JSON → YAML: JSON.parse ഇൻപുട്ട് validate ചെയ്‌ത് JavaScript value produce ചെയ്യുന്നു; jsyaml.dump(value, { indent, lineWidth: -1, sortKeys: false }) YAML 1.2 form write ചെയ്യുന്നു. Multi-document ഓൺ, input array ഒരൊറ്റ element per document ആക്കി --- separators ഉൾക്കൊണ്ട് dump ചെയ്യുന്നു.
  3. YAML → JSON: jsyaml.loadAll ഇൻപുട്ടിലെ ഓരോ document-ഉം (--- separators auto handle ചെയ്‌ത്) array-ലേക്ക് parse ചെയ്യുന്നു; single-document inputs unwrap ചെയ്‌ത് JSON output document-ഇനെ one-element array ആകില്ല.
  4. Indent (2/4 spaces), Pretty-print configurable. Pretty-print off: JSON.stringify(value) whitespace ഇല്ലാതെ minified JSON emit ചെയ്യുന്നു.
  5. Output read-only textarea-ൽ write ചെയ്യുന്നു. YAML parse failures-ൽ error message js-yaml-ന്റെ e.mark report ചെയ്‌ത 1-indexed line, column ഉൾക്കൊണ്ടിരിക്കും.

ഈ ടൂൾ JSON, YAML convert ചെയ്യാൻ ഉപയോഗിക്കേണ്ടത് എന്തുകൊണ്ട്?

  • സ്വകാര്യത: ഓരോ parse, transform, emit pass-ഉം ബ്രൗസറിൽ. Kubernetes secrets, signed JWTs, proprietary configs ഉൾക്കൊണ്ടുള്ള data server-ൽ reach ആകില്ല.
  • Multi-document YAML: jsyaml.loadAll --- separators recognise ചെയ്‌ത് documents-ന്റെ array return ചെയ്യുന്നു; single-doc cases unwrap, multi-doc JSON array preserve.
  • Anchors, aliases resolved: YAML-ന്റെ &anchor / *alias mechanism js-yaml-ന്റെ default schema handle ചെയ്യുന്നു. ഒരിക്കൽ define ചെയ്‌ത് twice reference ചെയ്‌ത value JSON object-ൽ equal values hold ആകും.
  • CDN ഇല്ല, telemetry ഇല്ല: js-yaml.min.js library page-ന്റെ same origin-ൽ ship ചെയ്‌ത്, ടൂൾ offline, corporate proxies-ൻ്റെ പുറകിൽ, air-gapped environments-ൽ work ചെയ്യുന്നു.

JSON ↔ YAML conversion-ന്റെ സാധാരണ ഉപയോഗങ്ങൾ?

JSON, YAML ഇടയ്ക്ക് pivot ചെയ്യൽ DevOps, platform engineering, API tooling-ൽ ഉടനീളം കാണുന്നു:

  • Kubernetes manifests: YAML Deployment, ConfigMap, HelmRelease in-house policy validator (Joi, Ajv, OPA Rego) programmatically lint ചെയ്യാൻ JSON-ലേക്ക് convert, cluster apply-ന് YAML-ലേക്ക് back.
  • CI/CD workflows: GitHub Actions workflow.yml JSON-ൽ round-trip ചെയ്‌ത് code-generator matrix, job dependencies rewrite ചെയ്‌ത്, PR-ന് cleaned-up YAML emit.
  • OpenAPI specs: backend auto-generated docs-ൽ നിന്ന് JSON openapi.json paste ചെയ്‌ത് human-edited reference-ന് repo-ൽ check in ചെയ്‌ത openapi.yaml-ലേക്ക് convert.

JSON ↔ YAML round-trip ഉദാഹരണം?

{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"name":"web"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"web"}}}} paste ചെയ്‌ത് JSON → YAML mode-ൽ CONVERT അടിച്ചാൽ apiVersion: apps/v1 first line ഉൾക്കൊണ്ട് indented YAML ഉണ്ടാകുന്നു. ആ YAML YAML → JSON mode-ൽ Pretty-print on ആക്കി feed ചെയ്‌ത് ഒറിജിനൽ object stable JSON.stringify(value, null, 2)-ൽ byte-for-byte return ആകും.

ഈ JSON ↔ YAML converter ബ്രൗസറിൽ run ആകുമോ?

അതെ. ഓരോ parse, transform, emit pass-ഉം browser tab-ൽ JavaScript ആക്കി locally run ആകുന്നു. Bundled js-yaml library page-ന്റെ same origin-ൽ ship ചെയ്‌ത് — CDN ഇല്ല, fetch ഇല്ല, XMLHttpRequest ഇല്ല. Page load ആയ ശേഷം offline work ചെയ്യുന്നു. Kubernetes secrets, JWT payloads, signed CloudFormation YAMLs, proprietary configs device-ൽ.

Multi-document YAML converter handle ചെയ്യുന്നത് എങ്ങനെ?

YAML ഒരൊറ്റ stream-ൽ --- ഉൾക്കൊള്ളുന്ന lines ഉൾക്കൊണ്ട് multiple documents support ചെയ്യുന്നു. YAML → JSON-ൽ converter jsyaml.loadAll call ചെയ്‌ത് ഓരോ document-ഉം JavaScript value ആക്കി return ചെയ്യുന്നു. ഒരൊറ്റ document ഉണ്ടെങ്കിൽ JSON output ആ document directly; രണ്ടോ അധികമോ ഉണ്ടെങ്കിൽ JSON output array. JSON → YAML-ൽ, input JSON array ആണ്, Multi-document toggle ഓൺ, ഓരോ array element-ഉം --- separators ഉൾക്കൊണ്ട് document ആക്കി emit ചെയ്യുന്നു.

YAML anchors, aliases support ഉണ്ടോ?

ഉണ്ട് — &anchor definitions, *alias references js-yaml-ന്റെ default schema load step-ൽ resolve ചെയ്യുന്നു. YAML input-ൽ defaults: &d\n retries: 3\n timeout: 30\njob_a:\n <<: *d\njob_b:\n <<: *d parse ചെയ്‌ത് job_a, job_b ഇരുവർക്കും retries: 3, timeout: 30 ഉള്ള JSON object produce ചെയ്യുന്നു.

JSON-ലേക്ക് convert ചെയ്‌ത് back ആക്കുമ്പോൾ YAML comments preserve ആകുമോ?

ഇല്ല — js-yaml parse step-ൽ comments strip ചെയ്യുന്നതിനാൽ YAML → JSON → YAML round-trip ഓരോ #-prefixed line-ഉം lose ചെയ്യും. Comment preservation critical ആണെങ്കിൽ CST + AST API ship ചെയ്യുന്ന yaml npm package ഉപകരിക്കും. Config-conversion workflows-ന് trade-off acceptable: round-tripped YAML ഓരോ key, value, anchor, alias-ഉം keep ചെയ്യുന്നു, human-authored comments ഇല്ലാതെ.

Custom YAML tags-ന് എന്ത് സംഭവിക്കുന്നു?

Converter js-yaml-ന്റെ DEFAULT_SCHEMA ഉപയോഗിക്കുന്നു — !!str, !!int, !!float, !!bool, !!null, !!seq, !!map, !!binary, !!timestamp understand ചെയ്യുന്നു. Custom, application-specific tags (ഉദാ. CloudFormation-ൽ !Ref, Ansible-ൽ !vault) recognise ആകില്ല, clear error surface ചെയ്യും. CloudFormation-ന്: custom tags expand ചെയ്‌ത് ഇവിടെ paste ചെയ്യാൻ aws cloudformation package + --output-template-file flow ഉപയോഗിക്കൽ.

ഈ JSON ↔ YAML converter js-yaml@4.1.0 same origin-ൽ bundled ആക്കി ship ചെയ്‌ത്, multi-document streams, anchors/aliases out of the box support ചെയ്‌ത്, YAML parse errors line, column ഉൾക്കൊണ്ട് report ചെയ്യുന്നു. Upload ഇല്ല, CDN ഇല്ല, telemetry ഇല്ല — ഓരോ byte-ഉം ബ്രൗസറിൽ.