从JSON字符串中提取全名

时间:2019-11-07 16:27:26

标签: json json-query

我有一个json字符串,如下例所示,我需要从中提取成员的全名。

我知道我可以分别提取它们

 $.members[*].lastName   and    $.members[*].firstName

,但是我似乎无法弄清楚如何在一个JSON查询中将两者结合在一起。我读过有关使用“,”作为手段的信息,但我不知道具体情况如何。

{
"group": "BLUE",
  "members": [
    {
       "memberId": "00081",
       "firstName": "JOHN",
       "lastName": "SMITH",
       "mail": "JSMITH@EXAMPLE.com"
    } ,
    {
       "memberId": "00081",
       "firstName": "JANE",
       "lastName": "DOE",
       "mail": "JDOE@EXAMPLE.com"
    }
  ]
}

预期结果:[John Smith,John Doe]

任何帮助或指导将不胜感激,我以前从未使用过JSON查询。

1 个答案:

答案 0 :(得分:0)

我经过十多个小时的尝试和研究才发现:

program g
implicit none
    real::q,n,s,z,q2,y,free_board,r,b,e,A,h,t
    write(*,100)"pls insert discharge Q ="
    read(*,*)q
    write(*,100)"please insert Manning coefficient n ="
    read(*,*)n
    write(*,*)"please insert slope of the hydraulic channel ="
    read(*,*)s
    write(*,*)"please inset Z ="
    read(*,*)z
    write(*,*)"how much of b/y do you want?"
    write(*,*)"if it not important right 2.5"
    read(*,*)e
    if(e<2.or.e>5)then
        stop
    end if
    y=0

    do
        b=y*e
        A=b+2*y*((1+Z**2)**(0.5))
        R=((b+z*y)*y)/(b+(2*y*(1+z**2)**(0.5)))
        h=(1/n)*(r**(2/3))*A*(s)**0.5
       if( abs(h-q)<0.01) then
        exit
       end if




       y=0.001+y
    end do
    free_board=0.2*y
    h=free_board+y
    t=b+2*y*z


    write(*,100)"free board="
    write(*,*) free_board
    write(*,100)"y="
    write(*,*)y
    write(*,100)"b="
    write(*,*)b
    write(*,100)"T="
    write(*,100)t














    100 format(A)
end program g

我不知道我必须使用''。 希望这对其他人有帮助。