首页 全栈极客与开发辅助内容详情

YAML to Properties Converter: Spring Config Both Ways, Nested Keys Flattened - Flatten the tree, rebuild it back, verify the round trip

2026-11-17 3 访客
YAML to Properties Converter: Spring Config Both Ways, Nested Keys Flattened

站点名称:YAML to Properties Converter: Spring Config Both Ways, Nested Keys Flattened

所属分类:全栈极客与开发辅助

官方网址:https://www.9314.cn/tools/yaml-properties/en/

SEO查询: 爱站网 站长工具

进入网站

站点介绍

YAML to Properties Converter: Spring Config Both Ways, Nested Keys Flattened

Inherited project, configs in properties; new teammate, commits in yml. One service, two dialects, key names eyeballed side by side - miss one and the pager goes off at 2 a.m. After an hour of pasting two config files back and forth that day, what I wanted was a converter that could prove nothing got lost. This page was built to that spec: both directions, a round-trip check, all in the browser.

The short version

  • Both ways: YAML to Properties flattens nested keys into server.port=8080; Properties to YAML rebuilds dozens of flat lines into a hierarchy, level by level.
  • Two array styles: comma (items=a,b,c, saves lines) or indexed (items.0=a per line) - Spring Boot accepts both, and indexed keeps per-element comments.
  • Type inference: 8080 comes out a number, true/false a boolean, empty values null; only quoted values stay strings - the way back never guesses.
  • Round-trip check: convert over, convert back, compare every key and value; nothing reports green until the whole set matches.
  • Parsing and conversion stay in the browser - configs never uploaded, works offline; 1MB in milliseconds.

Do comments survive?

Yes. A # comment in YAML moves into Properties attached to the nearest key below it; Properties comments ride back into YAML the same way. The one exception is comments at the very top before any key appears - those land at the head of the output.

What syntax is handled

YAML side: mappings, sequences, indentation nesting, flow style ([a, b], {k: v}), single- and double-quoted strings, numbers, booleans, null (~ or empty), comments, block scalars | and >. Properties side: both = and : separators, backslash continuations, \u4e2d Unicode escapes, # and ! comments.

Fair warning: anchors &, multi-document --- and tags !! are not supported - they raise an error with a line number instead of silently dropping content.

FAQ

How do arrays look after converting YAML to Properties?

Two styles to pick from: comma-separated (items=a,b,c) or indexed (items.0=a, items.1=b, items.2=c). Spring Boot accepts both officially; the indexed style keeps per-element comment positions while the comma style saves lines. Switch in the options before converting.

Going Properties back to YAML, do numbers and booleans become strings?

No, types are inferred automatically: 8080 comes out as a number, true/false as booleans, empty values as null; only quoted values stay strings. To force a value to remain a string, wrap it in quotes in the Properties file.

Does a round trip match the original?

The key-value set matches exactly: every key and every value (numbers, booleans, null, arrays included) corresponds one to one after the round trip, and the page has a round-trip check button to verify on the spot. Ordering and layout may differ (Properties sorts keys more stably), and block-scalar multi-line text becomes an escaped single line and back.

Does my configuration get uploaded to a server?

No. Parsing and conversion run entirely in this device's browser - there is no upload endpoint and the page works offline. Only interface options like array style and indent width live in this browser's localStorage; they do not follow you to another device, and Clear my data in the footer removes them. And do not paste production secrets into any online tool.

中文版:https://www.9314.cn/tools/yaml-properties/

 暂无评论,快来抢沙发吧~

发布评论