E
E
error 4042019-08-01 18:56:02
JavaScript
error 404, 2019-08-01 18:56:02

Can I give json object by url?

There is this json:

{
 	"49432": {
 		"class": "7",
 		"type": "Учебник",
 		"subject": "Алгебра",
 		"authors": "-",
 		"icon": "-",
 		"tasks": {-}
 	},
 	"102938": {
 		"class": "8",
 		"type": "Учебник",
 		"subject": "Литература",
 		"authors": "-",
 		"icon": "-",
 		"tasks": {-}
 	}
 }

and it will be much larger, can I somehow use js to make it so that, for example, the link site/json/49432.json or site/json/49432 displays an object:
"49432": {
 		"class": "7",
 		"type": "Учебник",
 		"subject": "Алгебра",
 		"authors": "-",
 		"icon": "-",
 		"tasks": {-}
 	}

?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
qbr-code, 2019-08-01
@qbr-code

Yes it is possible. Put your json in some variable, and then put this variable in the JSON.stringify function (you can read more here )
After that, you can send a request with your json wherever you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question