File size: 794 Bytes
61a25a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import json

# Load JSON file
with open('s_app_s_step.json', 'r', encoding='utf-8') as file:
    data = json.load(file)

# Extract all query values and join them with newlines
query_list = []
for entry in data:
    queries = entry.get('query', [])
    for query in queries:
        # Ensure each query is a string
        if isinstance(query, dict):
            query_list.append(json.dumps(query, ensure_ascii=False))  # Convert dict to JSON string if needed
        else:
            query_list.append(query)

# Join queries with newline separator
all_queries = '\n'.join(query_list)

# Write to a new file
with open('all_queries.txt', 'w', encoding='utf-8') as output_file:
    output_file.write(all_queries)

print("All queries have been saved to all_queries.txt")