Ad Widget

Collapse

Stuck on Jsonpath pre-processing LLD rule

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #1

    Stuck on Jsonpath pre-processing LLD rule

    Hi I got a jsonoutput where it is structured like the image (deleted values but the structure is valid)
    Click image for larger version

Name:	image.png
Views:	141
Size:	79.7 KB
ID:	475495
    My master item gets the entire JSON output and it basicly repeats about 44 items​
    In my Discovery item (depended item on the complete json)
    I do preprocessing: $.Applications..Descriptor
    LLD Macro: {#APPNAMES} Jsonpath: $.Name

    This part works with the item prototype
    The key: Supervisor_[{#APPNAMES}] generates items with the correct key names ({#APPNAMES} contains the expected value.
    I'm stuck on getting the blue StatusCode value
    I tried: $..[?@(.Name=='{#APPNAMES}')].Status.StatusCode.first()
    $.Applications.[Supervisors]..[?(@Descriptor.Name=="{#APPNAMES}")] << With single and Double quote tested and supervisors with and without brackets.
    I think I'm close to the solution however even with site jsonpath.com and changing the LLD macro to a value of the Json output I can't get the status code returned
  • Answer selected by Brambo at 07-12-2023, 17:35.
    Brambo
    Senior Member
    • Jul 2023
    • 245

    Update by myself.
    It looks like
    Code:
     $.Applications..Supervisors[?(@.Descriptor.Name=="{#APPNAMES}")].Status.StatusCode
    returns the correct value... now only fix the string / interger issue
    edit: fixed with .first() at the end of the jsonpath.
    Last edited by Brambo; 07-12-2023, 16:19.

    Comment

    • Brambo
      Senior Member
      • Jul 2023
      • 245

      #2
      Update by myself.
      It looks like
      Code:
       $.Applications..Supervisors[?(@.Descriptor.Name=="{#APPNAMES}")].Status.StatusCode
      returns the correct value... now only fix the string / interger issue
      edit: fixed with .first() at the end of the jsonpath.
      Last edited by Brambo; 07-12-2023, 16:19.

      Comment

      Working...