JSON Plugin - Array Without name

  • Hi devs,

    I'm working with a project that receives JSON responses

    Everything is working perfectly but my problem is in handling the incoming data

    I can not manipulate the data because I get them inside an unnamed [] array

    I would like to know if there is any way to get the information without handling this array in javascript.

    Example of the array below.

    [{
    	"id": 7647,
    	"codigo": "78937680",
    	"descricao": "Pel\u00edcula de Raios Omega",
    	"quantidade1": 10,
    	"imagem_principal": {
    		"id": "_20181018020358990",
    		"url": "http:\/\/someurl",
    		"principal": true
    	},
    	"vip": 150,
    	"custo_utilizado": 3,
    	"filhos": [{
    		"id": 7648,
    		"codigo": "",
    		"descricao": "Pel\u00edcula de Raios Omega - MATRIZ",
    		"quantidade1": 50,
    		"codigo_grade": "0001"
    	}, {
    		"id": 7649,
    		"codigo": "",
    		"descricao": "Pel\u00edcula de Raios Omega - QUIOSQUE 1",
    		"quantidade1": 50,
    		"codigo_grade": "0002"
    	}, {
    		"id": 7650,
    		"codigo": "",
    		"descricao": "Pel\u00edcula de Raios Omega - QUIOSQUE 2",
    		"quantidade1": 50,
    		"codigo_grade": "0003"
    	}]}]

    Thanks!

  • have you ever tried FrenchYann JSON Plugin for doing this?

  • have you ever tried FrenchYann JSON Plugin for doing this?

    Hi,i using Contruct 3 and this plugin is for C2, but thanks.

    i using a workaround to manage my json data, below a example manipulating the json only with C3 and no javascript "but can be used too"

  • LuisCGForte you can refer to the current item using a full stop "." and the top item with a blank string "".

    So the following event sheet:

    Would give you:

    outer 7647, inner 7648, inner 7649, inner 7650

    That should solve your problem without needing to wrap the array in an object.

  • LuisCGForte you can refer to the current item using a full stop "." and the top item with a blank string "".

    Thanks! Its works.

    This is exactly the way I was looking for.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello C3 team

    This json loop feature are broken on the most recent version of C3 "135.3 BETA"

    The example above are returning only first value, others values are comming with 0 "zero"

    please fix this xD

  • Nepeo

  • Thanks for letting me know LuisCGForte I will check this out. For future reference it's better to file issues on GitHub when you find a problem.

  • Is a pleasure

    github.com/Scirra/Construct-3-bugs/issues/2568

    I posted here first because my work is stopped, never using BETA release for main projects again lol

  • Now that the C3 runtime is properly released we're trying to increase the frequency on Stable releases. So hopefully you won't be missing out on new features for too long by staying on the stable channel.

    Saying that, it is appreciated having more users on the beta channel. We're trying to wind up to stable release right now so if you hadn't noticed this it would have probably got into the next stable!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)