简体   繁体   English

如何使用json进行搜索并以html的搜索结果显示选定的项目详细信息?

[英]How to search using json and show selected project details form search result in html?

I have a json file called default.json. 我有一个名为default.json的json文件。 In search project name or project id in search field. 在搜索项目名称或搜索字段中的项目ID中。 Selected result form search box should show project details and get selected side bar project name. 选定结果表单搜索框应显示项目详细信息并获得选定的侧栏项目名称。

here is the result showed in json: 这是在json中显示的结果:

    "projects": [
    {
        "instances": null,
        "name": "decodingideas",
        "projectid": "decodingideas-147616",
        "projectnumber": 334691107943,
        "orgid": "",
        "orgname": "",
        "parentid": "",
        "parenttype": ""
    },
    {
        "instances": null,
        "name": "pupil-workers",
        "projectid": "pupil-workers",
        "projectnumber": 455648594684,
        "orgid": "",
        "orgname": "",
        "parentid": "",
        "parenttype": ""
    },

Search box html code: 搜索框html代码:

  <nav class="navbar navbar-dark sticky-top flex-md-nowrap p-0" 
  style="background-color:#3B78E7">
  <a class="navbar-brand col-sm-3 col-md-2 mr-0"  href="#">GCP Projects</a>
  <input class="form-control form-control-dark w-100" type="text" 
placeholder="Search" aria-label="Search">
  <ul class="navbar-nav px-3">
    <li class="nav-item text-nowrap">
      <a class="nav-link" href="#">Sign out</a>
    </li>
  </ul>
</nav>

Here is the screenshot which i needed: 这是我需要的屏幕截图: 在此处输入图片说明

here is the screenshot 2 这是屏幕截图2 在此处输入图片说明

You can use Lodash . 您可以使用Lodash It is easy to use and very helpful library. 它易于使用,非常有用的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM