extract key from json response available under tag html script tags

In rest-assured,¬† my json response is like below¬† which has html and script tag. JSON is available in script tag and I want to read key ‘LT’ from the JSON available under <script> tag. I have used the same method what is used in this forum to get response.

<html>
<head>

</head>
<body>
<script id=”configData type=”application/json”>{“authorizeRememberMe”:true,”allowRemoteLogin”:false,”passwordPolicy”:{“allowPasswordRenewalPolicy”:false,”allowPasswordWithUsername”:false,”allowPasswordWithFirstname”:false,”allowPasswordWithLastname”:false,”minimumLength”:8,”minimumDigits”:1,”minimumLetters”:1,”minimumLowerCase”:1,”minimumUpperCase”:1,”ageLimit”:-1,”ageMin”:-1,”remindUserBefore”:-1,”allowPasswordReuse”:false,”historyLength”:5,”regexp”:[],”specialCharactersAllowed”:[“!”,”#”,”=”,”@”,”[“,”\\”,”]”,”^”,”_”,”{“,”|”,”}”,”$”,”%”,”\u0026″,”(“,”)”,”*”,”+”,”-“],”minimumSpecial”:0,”remindUserBeforeMilliseconds”:-86400000},”browserLocale”:”en_US”,”lt”:”LT-21098-xUSqW32Vbbfu0uZhyre2uJFfvs9qvn”,”compassImgUrl”:”https://vdevm.ux.dsone.com:453/iam/resources/img/3passTxt.png”,”countries”:{}}</script>
<script>
</body>
</html>

How to extract the key which is hidden under html and script tag with rest-assured. Please help.

Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.