Classify as json parsing array - if there are certain characters in the array, classify as arrays that exist!!!!!

Asked 1 years ago, Updated 1 years ago, 108 views

The application is being made with swift now.

I'm having a hard time parsing the json file!

{[1, A, Ghana, 12345, abcd],  
[2, A, Dara, 156489, abed], 
[3, B, Maba, 189651, wqin], 
[4, C, SAA, 189651, apeo]
let makeA = [1, A, Ghana, 12345, abcd] [2, A, Dara, 156489, abed]]
Let makeB = [3, B, Maba, 189651, ewqin]
Let makeC = [4, C, SaA, 189651, apeo]

I want to make it an array of makeA, makeB, and makeC like this!!!

swift json parsing

2022-09-22 12:01

1 Answers

It's not a question of wanting to do something to do. The question to ask is, how do you translate this into English?

Maybe you want to do something like this.

For each of the [blah blah blah] shapes in the JSON, if there is a second element in the array, add "make" to the element to give it a new name, and pair "array" to the name.

This is what happens when you write this in English.

for each [ blah blah ] (say "TheArray") in the JSON,
    if TheArray has second element,
        let's make a new name (say "NewName") by putting "make" before that element
        and let TheArray have that NewName

Huh? Don't you think it's going to be a code if you just translate it into swift? Try it!


2022-09-22 12:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.