Home>

Using Vue.js on Flask and front end to server side.

I want to send data to server side using AXIOS, but it is not successful to send JSON with a list type. Do you have a professor?

version
Python 3.8
VUE 2.6.10


VUE.JS

Axios.get ('/Testapi', {PARAMS:
    {
        JSONLIST: QS.Stringify ([[]
            {ID: 1, Name: 'Hoge1'},
            {ID: 2, name: 'Hoge2'}
        ]
    )}})

Python

DEF GET (SELF):
    # Receive arguments from the client
    parser= ReqParse.RequestParser ()
    # Receive an argument named JSONLIST
    parser.add_Argument ('jsonlist')
    # Convert # dictionary form
    args= dict (self.parser.parse_args ())
    # Display the conversion result on the console
    Print (args ['jsonlist'] # 1
    # Parse.parse_qs
    parsed1= parse.parse_qs (ARGS [JSONList ']
    Print (parsed1) # 2
    parsed2= parse.parse_qsl (ARGS ['jsonlist'])
    Print (parsed2) # 3

1 of Print

0% 5BID% 5D= 1 &
0% 5BNAME% 5D= HOGE1 &
1% 5BID% 5D= 1 &
1% 5BNAME% 5D= HOGE2

2 Print results

{'0 [ID]': ['1'], '0 [name]': ['Hoge1'], '1 [ID]': ['1'], '1 [name ': [:' Hoge2 ']}

3 Print results

[('0 [ID]', '1'), ('0 [name]', 'Hoge1'), ('1 [ID]', '2'), ('1 [ID]', '2'), ('1 [ name] ',' Hoge2 ')]

For normal JSON and LIST, you can decompose successfully when using parse.parse_qs and parse.parse_qsl.
Each replaces Python Dictionary or List,
For JSON LIST, I can not share JSON LIST in Python and try trial and error.

Finally, I would like to process Python in the following form, but who would you like to lend you wisdom?

[{id: 1, name: 'Hoge1'}, {ID: 2, name: 'Hoge2'}]