PY
py
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
27
28
import json
from dataclasses import dataclass
@dataclass
class Product:
name: str
price: float
category: str
# JSON string containing an array of products
json_string = """
[
{
"name": "Acer Laptop",
"price": 1999.99,
"category": "Electronics"
},
{
"name": "Razor Phone",
"price": 799.99,
"category": "Electronics"
},
{
"name": "Python for Dummies",
"price": 39.99,
"category": "Books"
}
]
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run