JSON से TOML कन्वर्टर
Example
Input:
{"title": "Demo", "owner": {"name": "Ali"}}Output:
title = "Demo" [owner] name = "Ali"
इस converter के बारे में
TOML (pyproject.toml, Cargo.toml, Hugo configs) INI का बड़ा हुआ रूप है: typed values, tables और arrays एक unambiguous grammar के साथ। JSON से mapping की एक structural माँग है — TOML चाहता है कि plain key/value pairs किसी [table] header से पहले आएँ, इसलिए converter पहले scalars emit करता है, फिर tables, फिर array tables, recursively। Strings proper escaping के साथ TOML basic strings के रूप में लिखी जाती हैं; numbers अपना integer/float अंतर रखते हैं; scalars के arrays inline रहते हैं जबकि objects के arrays [[tables]] बन जाते हैं। JSON null का कोई TOML equivalent नहीं है — TOML बस absent keys को omit करता है; input में null चुपके से drop या fake करने के बजाय reported होता है।
अक्सर पूछे जाने वाले सवाल
JSON null का क्या होता है?
TOML में null नहीं होता। Converter अंदाज़ा लगाने के बजाय इस पर error देता है — key हटाएँ या इसे एक sentinel से बदलें जिसे आपका application समझता है।
मेरी keys क्यों reordered हुईं?
TOML syntax चाहता है कि bare key/values table headers से पहले हों; converter उन्हें group करता है (scalars, फिर tables) हर group के अंदर order सुरक्षित रखते हुए।