当前位置:网站首页>Vipshop work practice: Jason's deserialization application
Vipshop work practice: Jason's deserialization application
2022-06-26 09:08:00 【Feng Dashao】
JSON(JavaScript Object Notation) Is a lightweight data exchange format , It is JavaScript Subset , Easy to read and write . There are two common types of structures ,Key_Value An ordered list of sets and values for , They correspond to each other Python Dictionaries and lists in .
JSON There are the following methods in common use :

The following is based on the working practice in vipshop , demonstration Json Of deserialization application . Open one of the links , Visible mainly through API(Application Programming Interface) Load data . stay Request URL in ,? Behind it is a pile of contents that seem to be alien texts , These are all query strings . Pair with key value key=value The formal assignment of , Use... Between multiple key value pairs & come together . Query string is used for information transmission , The server can know what you want through it , So as to return the corresponding content to you .

First try to get the web page source code data , And then try to pass json() Method to decode the response content , As a result, the decoding error prompt is encountered .

stay " Preview" so , Not at all Json data format .

First use replace() Method hold ‘getMerchandiseDroplets1(’ and ‘)’ Delete , And then through json.loads() Method , After deserialization , Successfully converted to Python Data objects for - dict



Join the loop , You can use dict Value , Print out all relevant product names .
for i in range(33):
print(str1_json[‘data’][‘products’][i][‘title’])

边栏推荐
- Tutorial 1:hello behavioc
- XSS 跨站脚本攻击
- 行為樹XML文件 熱加載
- 【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(一)
- docker安装redis
- 1.Intro_ Math (white board derivation and reprint of station B)
- Dedecms applet plug-in is officially launched, and one click installation does not require any PHP or SQL Foundation
- dedecms小程序插件正式上线,一键安装无需任何php或sql基础
- External sorting and heap size knowledge
- Solution to the encoding problem encountered by the crawler when requesting get/post
猜你喜欢

微信小程序如何转换成百度小程序

PD快充磁吸移動電源方案

phpcms v9去掉phpsso模块

Construction and verification of mongodb sharding environment (redis final assignment)

Phpcms applet plug-in version 4.0 was officially launched

Graduation thesis management system based on SSM

Yolov5 advanced level 2 installation of labelimg

SRv6----IS-IS扩展
![[program compilation and pretreatment]](/img/c9/45353cf6578628ad44f149350873f5.png)
[program compilation and pretreatment]

如何编译构建
随机推荐
Yolov5进阶之四训练自己的数据集
修复小程序富文本组件不支持video视频封面、autoplay、controls等属性问题
SRv6----IS-IS扩展
Section IV HQL execution process
编辑类型信息
Phpcms V9 mobile phone access computer station one-to-one jump to the corresponding mobile phone station page plug-in
Backward usage
ImportError: ERROR: recursion is detected during loading of “cv2“ binary extensions. Check OpenCV in
关于小程序tabbar不支持传参的处理办法
爬虫 对 Get/Post 请求时遇到编码问题的解决方案
Uniapp uses uparse to parse the content of the background rich text editor and modify the uparse style
【程序的编译和预处理】
【MATLAB GUI】 键盘回调中按键识别符查找表
phpcms小程序插件4.0版正式上线
How to convert wechat applet into Baidu applet
运行时端的执行流程
拦截器与过滤器的实现代码
Computer mall based on SSM
ThreadLocal
Mongodb分片环境搭建和验证(redis期末大作业)