Jump to content

Recommended Posts

Posted

Hi Everyone,

i am a complete beginner to autoit and i am in a learning stage,so if this question looks so dumb,pls pardon me.

Can anyone help me with a code where i want to take only particular values from a text and store it to array

I have shared the input text which i have in below code window and i want to take only text's inside the Value tag ex:  "Value":"Copy_anything_inside_this"

i.e: "Value":"Jan 2016" ---->Copy Jan 2016 into a array[0,0]

"Value":"5.99"  --->Copy 5.99 into a array[0,1]

etc

 

{  
   "records":[  
      {  
         "checkbox":{  
            "marked":false,
            "rowNum":"0",
            "sortable":false
         },
         "0":{  
            "value":"Dec 2015"
         },
         "1":{  
            "id":"0_0",
            "value":"6.38"
         }
      },
      {  
         "checkbox":{  
            "marked":false,
            "rowNum":"1",
            "sortable":false
         },
         "0":{  
            "value":"Jan 2016"
         },
         "1":{  
            "id":"0_1",
            "value":"5.99"
         }
      },
      {  
         "checkbox":{  
            "marked":false,
            "rowNum":"2",
            "sortable":false
         },
         "0":{  
            "value":"Feb 2016"
         },
         "1":{  
            "id":"0_2",
            "value":"5.73"
         }
      },
      {  
         "checkbox":{  
            "marked":false,
            "rowNum":"3",
            "sortable":false
         },
         "0":{  
            "value":"Mar 2016"
         },
         "1":{  
            "id":"0_3",
            "value":"6.51"
         }
      }
   ],
   "recordsReturned":12,
   "totalRecords":12,
   "pageSize":25,
   "startIndex":0,
   "sort":"Timestamp",
   "dir":"ASC",
   "pclassid":0,
   "metadata":[  

   ]
}

 

Can anyone give me a rough idea how can i do this?

Posted (edited)

this is pretty rough

#include<array.au3>
_ArrayDisplay(StringRegExp(fileread("jsonstring.txt") , '".+"\:"(.+)"' , 3))

 

 

edit:  if you want the labels just capture that whole group (remove the parentheses) and then split each line on the colon?

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted

@mikell he said "rough" answers. :)

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted (edited)
19 hours ago, JohnOne said:

You could search for json udf, as that looks suspiciously like json.

Yes that's a JSON output, will start learning JSON UDF Soon .Thanks for help :)

Edited by Paranthaman

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...