Chen890
Chen890

Reputation: 31

Get attribute path from JSON

I was trying to find ways to get an attribute path from a JSON. However, I only see a path extractor if the path is known and not vice verca.

Here is an example: I'm looking to get the 'numComments' attribute path from the following JSON (the path is: inpage.header.numComments).

{
   "inpage": {
      "conversation": {
        "completeEmailRegistration": {
          "button": "重新寄出确认电邮",
          "succesMessage": {
            "first": "确认电邮已经寄到",
            "second": "请检查你的邮箱。"
          },
          "text": "请检查您的邮箱以完成账号登记手续。"
        },
        "loadMoreReplies": "Show More Comments",
        "loadMoreReviews": "显示更多评价",
        "loadReplies": "显示评论",
        "replyTyping": "{{value}}正在回复",
        "showAllMessages": "显示所有{{messagesCount}}回复",
        "showMoreMessagesErrorMessage": "无法得到更多回复",
        "sortMenu": {
          "best": "最好",
          "newest": "最新",
          "oldest": "最旧",
          "social": "社交",
          "sortBy": "排序方式"
        },
        "viewReplies": "显示回复",
        "newMessagesMobile_0": "{{numOfComments}} 条新评论",
        "newMessages_0": "查看 {{numOfComments}} 条新评论",
        "showMoreMessagesOnlyNumber_0": "{{messagesCount}} 个回复",
        "showMoreMessages_0": "再显示 {{messagesCount}} 个回复",
        "showPreviousMessages_0": "显示{{messagesCount}}个以前的回复",
        "typingUsers_0": "{{count}} 人在输入"
      },
      "header": {
        "comments": "评论",
        "commentsCount": {
          "more": "{{messagesCount}}帖子",
          "one": "1个帖子"
        },
        "conversation": "对话",
        "explore": "探索",
        "starsRating": "评价",
        "subheader": {
          "communityGuidelines": "社区准则",
          "gotIt": "明白了",
          "powered-by": "技术支持:",
          "text": "阅读我们的"
        },
        "viewing": "{{viewersCount}} 人正在观看",
        "shortNumComments": "({{messagesCount}})",
        "shortNumComments_plural": "({{messagesCount}})",
        "numComments": "{{messagesCount}}个评论",
        "numComments_plural": "{{messagesCount}}个评论",
        "numPosts": "{{messagesCount}}个帖子",
        "numPosts_plural": "{{messagesCount}}个帖子"
      }
}

Any suggestions?

Upvotes: 0

Views: 112

Answers (1)

zakk616
zakk616

Reputation: 1542

  1. install extension for chrome: JSON Viewer Pro

enter image description here

  1. click to open extension:

  2. click JSON input

enter image description here

  1. copy and paste your json in the window opened

  2. click parse json

  3. click the attribute for which you want its path

icon will appear from where can copy path of the attribute

enter image description here

Note: for this your JSON must be a verified and correct one, i see bunch of {, } inside data values. this may cause and invalid json error.

Upvotes: 1

Related Questions