How should I go about assigning json data to an array?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By shreyk27

I am currently working on a card trading 2d game (a multiplayer), and I created a JSON file as a card database containing cards data like which suit it belongs to and what`s its id and path to its texture file, I want to have four players each should get 13 cards, I am instancing a scene named card which is an Area2D node with Collision Shape2D and Sprite as a child. So, i thought of creating an array with all card objects and sub-dividing it into 4 arrays for four players.
I did the following:

extends Node

onready var cards_deck = "res://cards_deck.json"
var card = preload("res://Card.tscn")
var allInstances = []

func _ready():
	loadData()
	allInstances.shuffle()
	var player_1 = allInstances.slice(0,13)
	var player_2 = allInstances.slice(14,26)
	var player_3 = allInstances.slice(27,39)
	var player_4 = allInstances.slice(40,52)

    for i in range(0, 13):
        self.add_child(player_1[i])
		player_1[i].position = Vector2(500, 360) + Vector2(10, 0) * i
func loadData():
	var file = File.new()
	file.open(cards_deck, file.READ)
	var json = file.get_as_text()
	var json_result = JSON.parse(json).result
	file.close()
	allInstances.resize(52)
	var x = 1
	while x <= json_result.size():
		allInstances[x - 1] = card.instance()
		allInstances[x - 1].set_name(json_result[str(x)]["title"])
		allInstances[x - 1].get_node("Sprite").texture = load(json_result[str(x)]["image"])
		x+=1

Well this code works.
Is this approach good or is there any other approach i should follow?
I also want the ability to compare the cards in order to align them into a suit deck like a spade with a spade with respect to their numbers.

Thanks.