<p></p>
<p dir="auto">Right now, <code class="notranslate">GET /user/preferences/key</code> will (according to the <a href="https://wiki.openstreetmap.org/wiki/API_v0.6#Preferences_of_the_logged-in_user" rel="nofollow">wiki documentation</a>) "[return] a string with that preference's value." Which makes sense.</p>
<p dir="auto">So a <code class="notranslate">k="foo" v="{\"json\": true}"</code> would return <code class="notranslate">{"json": true}</code>, regardless of what format is requested (<code class="notranslate">GET /user/preferences/foo.xml</code>). The only things I can think of that could possibly change by adding a format:</p>
<ul dir="auto">
<li>Wrapping the value, so <code class="notranslate">{"key": "foo", value: "{\"json\": true}"</code> or <code class="notranslate"><preference k="foo" v="{\"json\": true}"/></code>, which I don't think adds any value to users. They already <em>know</em> the key, and regardless of the response, they still have to do the appropriate action with the value. Just with more steps, and possibly assuming that there was some kind of server-side validation.</li>
<li>Validating the value prior to return, although this is probably unwise since the value could be of any arbitrary format (xml, json, base64 encoded binary data), which means there would have to be format sniffers of some type.</li>
</ul>
<p dir="auto">The point being that the preference value can be anything, and the application developer is going to have to deal with it (unless it is dealt with inside the website code), so I don't think this <em>specific</em> endpoint (<code class="notranslate">/user/preferences/key</code>) can realistically return anything besides the plain text value.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3787#issuecomment-1309421713">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPGJIC2RQLY3DDZIULWHQMC7ANCNFSM6AAAAAARZPOMC4">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLN5UE434KENXMII5VTWHQMC7A5CNFSM6AAAAAARZPOMC6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSOBQYJC.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/3787/c1309421713</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3787#issuecomment-1309421713",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3787#issuecomment-1309421713",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>