Skip to main content
Nintex Community Menu Bar
Solved

Regex json to filter out value

  • Dec 13, 2022 12:41 PM UTC
  • 8 replies
  • 797 views
  • Translate All

Forum|alt.badge.img+4

I’ve got the following json response:
{"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IkExRUQxNDU5MDM3QUMxOEVDRDIwQjMxNjAzRDQwRUE0NjU3MTU3N0JSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6Im9lMFVXUU42d1k3TklMTVdBOVFPcEdWeFYzcyJ9.eyJuYmYiOjE2Nz","expires_in":86400,"token_type":"Bearer","scope":"test-scope"}

 

In Nintex workflow I want to filter out the value of the ‘access_token’ key. Can someone provide me the regex for this? 

Best answer by Garrett

Hi @Bob_S 

 

This is using Workflow O365 but I believe it should work for you.

String: <Your source JSON>

REPLACE Operation

Pattern: ({"access_token":")(.*)(","ex)(.*})

Replacement String: $2

Output: <Your output variable>

 

Result Output (using Log to History)

 

Hope that helps

View original

8 replies

Garrett
Forum|alt.badge.img+16
  • Scout
  • Answer
  • Dec 13, 2022 2:25 PM UTC

Hi @Bob_S 

 

This is using Workflow O365 but I believe it should work for you.

String: <Your source JSON>

REPLACE Operation

Pattern: ({"access_token":")(.*)(","ex)(.*})

Replacement String: $2

Output: <Your output variable>

 

Result Output (using Log to History)

 

Hope that helps

Translate

Forum|alt.badge.img+2
  • Rookie
  • Sep 11, 2023 2:20 PM UTC

Hi Bob, have you found a solution for this? I also just got the same task of extracting an access_token from json on Nintex for SharePoint on prem.

Translate

Forum|alt.badge.img+4
  • Author
  • Scholar
  • Sep 12, 2023 5:37 AM UTC

Yeah my problem got solved. Are you facing the exact same issue? Or do you need to extract from a different json?

Translate

Forum|alt.badge.img+2
  • Rookie
  • Sep 12, 2023 6:50 AM UTC

My json is in a different order but the content is (nearly) the same.

Translate

Forum|alt.badge.img+4
  • Author
  • Scholar
  • Sep 12, 2023 6:59 AM UTC

Look at the solution given above, that worked for me! Or send an example of your json so I can take a look at it.

Translate

Forum|alt.badge.img+2
  • Rookie
  • Sep 12, 2023 7:05 AM UTC

My json looks like this (access_token shortened for readability):

{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"I6Il9BM2d5bE.eyJhdMMjLTW0_QDjv-7eTK0-uC3hb-JcCMBCag"}

Translate

Forum|alt.badge.img+4
  • Author
  • Scholar
  • Sep 12, 2023 8:07 AM UTC

Can you put in this:


Pattern: ({*.)(.*)("access_token":")(.*)(.*"})

Replacement string: $4 

Translate

Forum|alt.badge.img+2
  • Rookie
  • Sep 12, 2023 9:06 AM UTC
Thank you, Bob. This works for me.
Translate