<small id='dPpUT'></small><noframes id='dPpUT'>

    <tfoot id='dPpUT'></tfoot>

  1. <legend id='dPpUT'><style id='dPpUT'><dir id='dPpUT'><q id='dPpUT'></q></dir></style></legend>
  2. <i id='dPpUT'><tr id='dPpUT'><dt id='dPpUT'><q id='dPpUT'><span id='dPpUT'><b id='dPpUT'><form id='dPpUT'><ins id='dPpUT'></ins><ul id='dPpUT'></ul><sub id='dPpUT'></sub></form><legend id='dPpUT'></legend><bdo id='dPpUT'><pre id='dPpUT'><center id='dPpUT'></center></pre></bdo></b><th id='dPpUT'></th></span></q></dt></tr></i><div id='dPpUT'><tfoot id='dPpUT'></tfoot><dl id='dPpUT'><fieldset id='dPpUT'></fieldset></dl></div>

      <bdo id='dPpUT'></bdo><ul id='dPpUT'></ul>

    1. 德国文化 - 用逗号从 JSON 中获取双数

      German culture - get double number from JSON with a comma(德国文化 - 用逗号从 JSON 中获取双数)
        <i id='89tls'><tr id='89tls'><dt id='89tls'><q id='89tls'><span id='89tls'><b id='89tls'><form id='89tls'><ins id='89tls'></ins><ul id='89tls'></ul><sub id='89tls'></sub></form><legend id='89tls'></legend><bdo id='89tls'><pre id='89tls'><center id='89tls'></center></pre></bdo></b><th id='89tls'></th></span></q></dt></tr></i><div id='89tls'><tfoot id='89tls'></tfoot><dl id='89tls'><fieldset id='89tls'></fieldset></dl></div>

              <tbody id='89tls'></tbody>
            <tfoot id='89tls'></tfoot>
              <bdo id='89tls'></bdo><ul id='89tls'></ul>
              <legend id='89tls'><style id='89tls'><dir id='89tls'><q id='89tls'></q></dir></style></legend>

              <small id='89tls'></small><noframes id='89tls'>

                本文介绍了德国文化 - 用逗号从 JSON 中获取双数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我有一个供内部使用的 MVC Web-API 应用程序.我有一些带有表单和数字字段的页面.我需要在德国计算机上安装它,用户将只是德国人.在德国,他们写3,5"而不是3.5"(带逗号).

                I have an MVC Web-API application for inner use. I have some pages with forms and numeric fields. I need to install this on a German computer, and the users will be only Germans. In Germany they write "3,5" instead of "3.5" (with a comma).

                在 IIS 配置中,文化是不变文化",并且由于计算机是德语 - 本地化是de-DE".

                In IIS configuration the culture is "Invariant culture" and since the computer is German - the localize is "de-DE".

                当用户在字段中写入3,5"时 - 我可以在 firebug 中看到3,5"是以 JSON 格式发送的,但服务器将其获取为35".

                When the users write "3,5" in the field - I can see in firebug that "3,5" is what is sent in JSON, but the server gets it as "35".

                我可以在服务器端处理它吗?(我不想更改 json,因为我需要在每个字段和页面中都这样做)

                Can I handle it on server-side? (I don't want to change the json because I'll need to do it in every field and page)

                 using Newtonsoft.Json;
                 using Newtonsoft.Json.Converters;
                 public class ItemsController : ApiController, IDisposable
                 {
                        [Authorize(Roles = "Admin")]
                        [HttpPost]
                        public HttpResponseMessage UpdateItem(ItemViewModel itemVM)
                        {
                            // JSON data sent data.NumProp1 = "3,5"
                            // itemVM.NumProp1 contains "35" instead of "3.5"
                        }
                }
                

                推荐答案

                您不应该本地化您的 JSON - 请参阅 http://www.json.org 用于规范(仅显示点作为分隔符)和 JSON 序列化时如何本地化? 类似的问题.

                You should not localize your JSON - see http://www.json.org for the spec (which only shows the dot as a separator) and How to localize when JSON-serializing? for a similar question.

                我不建议您尝试阅读您自定义的 JSON - 现在听起来可能很快就赢了,但最终您根本没有使用 JSON.

                I wouldn't recommend trying to read your customized JSON - it may sound like a quick win right now, but in the end you simply aren't using JSON.

                这篇关于德国文化 - 用逗号从 JSON 中获取双数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Force JsonConvert.SerializeXmlNode to serialize node value as an Integer or a Boolean(强制 JsonConvert.SerializeXmlNode 将节点值序列化为整数或布尔值)
                Using JSON to Serialize/Deserialize TimeSpan(使用 JSON 序列化/反序列化 TimeSpan)
                Could not determine JSON object type for type quot;Classquot;(无法确定类型“Class的 JSON 对象类型.)
                How to deserialize a JSONP response (preferably with JsonTextReader and not a string)?(如何反序列化 JSONP 响应(最好使用 JsonTextReader 而不是字符串)?)
                how to de-serialize JSON data in which Timestamp it-self contains fields?(如何反序列化时间戳本身包含字段的JSON数据?)
                JSON.Net custom contract serialization and Collections(JSON.Net 自定义合约序列化和集合)

                <small id='sc6Mw'></small><noframes id='sc6Mw'>

                <tfoot id='sc6Mw'></tfoot>

                <legend id='sc6Mw'><style id='sc6Mw'><dir id='sc6Mw'><q id='sc6Mw'></q></dir></style></legend>
                  <bdo id='sc6Mw'></bdo><ul id='sc6Mw'></ul>

                    <tbody id='sc6Mw'></tbody>

                    • <i id='sc6Mw'><tr id='sc6Mw'><dt id='sc6Mw'><q id='sc6Mw'><span id='sc6Mw'><b id='sc6Mw'><form id='sc6Mw'><ins id='sc6Mw'></ins><ul id='sc6Mw'></ul><sub id='sc6Mw'></sub></form><legend id='sc6Mw'></legend><bdo id='sc6Mw'><pre id='sc6Mw'><center id='sc6Mw'></center></pre></bdo></b><th id='sc6Mw'></th></span></q></dt></tr></i><div id='sc6Mw'><tfoot id='sc6Mw'></tfoot><dl id='sc6Mw'><fieldset id='sc6Mw'></fieldset></dl></div>