Skip to main content
Nintex Community Menu Bar
Solved

Regex json to filter out value

  • December 13, 2022
  • 8 replies
  • 682 views

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
Translate
Did this topic help you find an answer to your question?

8 replies

Garrett
Forum|alt.badge.img+16
  • Scout
  • 904 replies
  • Answer
  • December 13, 2022

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
  • 8 replies
  • September 11, 2023

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
  • 12 replies
  • September 12, 2023

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
  • 8 replies
  • September 12, 2023

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

Translate

Forum|alt.badge.img+4
  • Author
  • Scholar
  • 12 replies
  • September 12, 2023

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
  • 8 replies
  • September 12, 2023

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
  • 12 replies
  • September 12, 2023

Can you put in this:


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

Replacement string: $4 

Translate

Forum|alt.badge.img+2
  • Rookie
  • 8 replies
  • September 12, 2023
Thank you, Bob. This works for me.
Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings