首页 \ 问答 \ JavaScript内部对象键,带有空格的字符串。?(JavaScript inner object key with a string having space .? [duplicate])

JavaScript内部对象键,带有空格的字符串。?(JavaScript inner object key with a string having space .? [duplicate])

我有一个以下格式的json对象,我试图检索关键“ krishna kk ”的等级 ,这给了我一个Uncaught SyntaxError: Unexpected token [ error。 任何人都可以帮助理解如何获取键名在其中有空格的内部对象数据。

[
    {"studentinfo": [
            {
               "rama nathan": {
                    "grade": "1",
                    "roleno": "9",
                    "score": 9
                }
            },
            {
                "krishna kk": {
                    "grade": "3",
                    "roleno": "9",
                    "score": 4
                }
            },
            {
                "john Doe": {
                   "grade": "2",
                    "roleno": "5",
                    "score": 7
                }
            }
        ],
    }
]

我的代码如下:

var stugrade = studentobject["0"].studentinfo["0"].[rama nathan].grade;

I have a json object in the below format and am trying to retrive the grade for the key "krishna kk" which gives me an Uncaught SyntaxError: Unexpected token [ error. can any one help to understand how to get the inner object data where the key name has spaces in it.

[
    {"studentinfo": [
            {
               "rama nathan": {
                    "grade": "1",
                    "roleno": "9",
                    "score": 9
                }
            },
            {
                "krishna kk": {
                    "grade": "3",
                    "roleno": "9",
                    "score": 4
                }
            },
            {
                "john Doe": {
                   "grade": "2",
                    "roleno": "5",
                    "score": 7
                }
            }
        ],
    }
]

My code as below :

var stugrade = studentobject["0"].studentinfo["0"].[rama nathan].grade;

原文:https://stackoverflow.com/questions/45245593
更新时间:2021-08-09 18:08

最满意答案

请阅读开发人员文档。 你可以在这里找到支持屏幕尺寸的信息

https://developer.android.com/training/basics/supporting-devices/screens.html

此外最初给出的尺寸值列表

如何在Android中为每个不同的屏幕大小定义dimens.xml?

希望能帮助到你


Please read the developer Docs. You can find information for supporting screen sizes here

https://developer.android.com/training/basics/supporting-devices/screens.html

Also Dimension values list originally given here

How to define dimens.xml for every different screen size in android?

Hope it Helps

相关问答

更多
  • 您还可以使用框架/线性布局。 我现在仍在使用dp,但数量较少,这减少了你所看到的巨大差异。 我希望你仍然能够理解,我没有让你的图像使用,所以只使用了颜色。 在此示例中,您应该使用wrap_content而不是set widths / heights。
  • 请阅读开发人员文档。 你可以在这里找到支持屏幕尺寸的信息 https://developer.android.com/training/basics/supporting-devices/screens.html 此外最初给出的尺寸值列表 如何在Android中为每个不同的屏幕大小定义dimens.xml? 希望能帮助到你 Please read the developer Docs. You can find information for supporting screen sizes here htt ...
  • 您需要获取支持库jar文件并将其放在项目“libs”文件夹中以便检测它。 您需要的jar文件位于\ extras \ android \ support \ v4下的SDK文件夹中,名为“android-support-v4.jar” You need to take the support library jar file and place it in your projects "libs" folder for it to be detected. The jar file you need is ...
  • 要拉伸和拟合任何可能的屏幕图像,您可以使用矢量(SVG)图标。 有关SVG支持的更多信息,请访问: http : //caniuse.com/svg 由于某些移动Webkit版本不支持SVG,您可以使用图标回退到自定义字体。 如果您可以使用仅黑白图标,则可以使用自定义字体制作矢量图标。 示例: http : //fortawesome.github.io/Font-Awesome/ To stretch and fit images for any possible screen you can use v ...
  • Android开发教程 Android为数百种不同屏幕尺寸的设备提供支持,从小型手机到大型电视机。 因此,将应用程序设计为与所有屏幕尺寸兼容非常重要,以便尽可能多的用户使用它。 但是与不同的设备类型兼容是不够的。 每种屏幕尺寸都为用户交互提供了不同的可能性和挑战,因此为了真正满足并给用户留下深刻印象,您的应用程序必须超越仅仅支持多个屏幕:它必须优化每个屏幕配置的用户体验。 - 详情请见: http : //fireandroids.blogspot.in/2014/01/developing-differe ...
  • UPDATE 如果你在xml中指定大小,我会建议使用dp,如果你动态地使用px,我建议使用px,但这是不好的建议。 我知道你讨厌听到这个,但这完全取决于你想要做什么。 如果您正在编写状态栏,无论屏幕大小如何,您总是希望它具有相同的大小 - 为此,请使用px。 我不知道你怎么能用dp做到这一点。 另一方面,假设你有一个想要成为屏幕一半的图像 - 你有几个选择。 如果你在代码中这样做,你可以使用 - 速度方面它是无关紧要的。 如果你是用xml做的,你可以直接将它设置为80dp,或者(这就是我的工作),只需使用带 ...
  • 您的问题是您已经为特定的屏幕尺寸而不是屏幕密度设计了位图。 简单地说,你不应该这样做 。 有大量不同的外形和屏幕尺寸,你不能希望有适合所有尺寸的图形尺寸。 所以你为540x960屏幕修复了这个问题......然后你的用户是480x854显示器(大多数hdpi motorola设备)? 如果您正在为此开发,是否会为1024x720和1280x720显示器添加不同的图形? 1280x800怎么样? 当然 - 处理这些问题可能会很痛苦,但这是我们为多样化设备付出的代价。 谷歌已经提供了相当数量的强大工具来处理这个 ...
  • 来自官方消息来源 注意 :Android系统不关注此属性,因此它不会影响应用程序在运行时的行为方式。 相反,它用于为您的应用程序启用Google Play等服务的过滤功能。 但是, Google Play目前不支持此属性进行过滤(在Android 3.2上) ,因此如果您的应用程序不支持小屏幕,则应继续使用其他大小属性。 更新: 看起来像android:requiresSmallestWidthDp根本不用于在Google Play上过滤。 只有android:smallScreens , android: ...
  • 这似乎是Qt X11图形系统中的一个错误。 如果我将QT_GRAPHICSSYSTEM设置为raster则图标会正确显示。 It seems to be a bug in Qt X11 graphics system. If I set QT_GRAPHICSSYSTEM to raster the icons are displayed properly.
  • 最后,我用以下proguard规则解决了这个问题: -ignorewarnings -dontoptimize -dontobfuscate -dontskipnonpubliclibraryclasses -ignorewarnings -keep class com.samsung.** { *; } -dontwarn com.samsung.** -dontwarn com.samsung.multiscreen.BuildConfig -dontwarn lombok.** Finally ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。