JSON not working?

Discussion in 'Plugin Development' started by Blockhead7360, Dec 26, 2016.

Thread Status:
Not open for further replies.
  1. Offline



    "[\"[{\\\"text\\\":\\\"" + ChatColor.RED + ChatColor.BOLD + " Test Thing\\n" + ChatColor.LIGHT_PURPLE + " Info Book\\n
    \\n\\\",\\\"hoverEvent\\\":{\\\"action\\\":\\\"show_text\\\",\\\"value\\\":\\\"" + ChatColor.YELLOW + "Test 1 " + ChatColor.GRAY + "(version " + IX.sr.getDescription().getVersion() + ")\\ncreated by Blockhead7360\\n\\n" + ChatColor.WHITE + "Click below to view 
    information on features!\\n\\nUse " + ChatColor.GREEN + "/item" + ChatColor.WHITE + " for crafting recipes!\\\"}},{\\\"text\\\":\\\"" + ChatColor.BLACK + "" + ChatColor.UNDERLINE + "Table of 
    \\\":\\\"show_text\\\",\\\"value\\\":\\\"" + ChatColor.AQUA + "Select a chapter from below\\\"}}]"
    That is some JSON from a plugin I'm creating for a book. Ignore the ending because I know that it isn't complete (as in closing brackets) because more JSON is added on to this. I know this isn't the problem because the next part of the JSON code is displayed.

    Anyways, here's the problem: The "Test Thing Info Book" part is displayed and the hover event works, but for some reason, the "Table of Contents" text is not displayed. Does anyone know why based on the JSON above?

    Also, the Table of Contents part is not displayed when the "[" & "]" are not displayed inside the quotation marks (by this, I mean the "\"", because it's in a Java string). When I do have those brackets, it just displays the JSON text itself (what you see above) instead of what it is supposed to output.

    I know this is confusing to understand probably because of the way I worded it, so if you have any questions, just ask me below.

  2. Offline


    You don't use ChatColor in a JSON format. You use color:

    Sent from my iPhone using Tapatalk
  3. Offline


    Actually, while that may be true, ChatColor in the string is simply replaced with the § symbol and it's corresponding code. This is supported in Minecraft and it works now. I don't think this is the problem though.
Thread Status:
Not open for further replies.

Share This Page