Command Block conditionals - doesn't work with quotation marks [duplicate]

You can´t have quotation marks within quotation marks, the game thinks that you have two text strings and some text in between.

You can use ' instead of the outer quotation mark, or you can mark a quotation mark as part of a string by using \

So either of these would work:

/setblock 262 73 -253 command_block[facing=east,conditional=false]{Command:'/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}'} replace
/setblock 262 73 -253 command_block[facing=east,conditional=false]{Command:"/execute if block 258 73 -254 chest{Items:[{id:\"minecraft:tripwire_hook\"}]}"} replace

The easiest way to get a complex /setblock command that works propperly is to create the block that you want to set and then to look at it and press F3+I. This will put a setblock command into your clipboard, that you can paste in with Ctrl+V:

/setblock 262 73 -253 minecraft:command_block[conditional=false,facing=east]{auto:0b,powered:0b,LastExecution:1497985L,SuccessCount:1,UpdateLastExecution:1b,conditionMet:1b,CustomName:'{"text":"@"}',Command:'/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}',LastOutput:'{"extra":[{"translate":"commands.execute.conditional.pass"}],"text":"[16:14:24] "}',TrackOutput:1b}

You can then remove the parts that are unimportant for your situation, to make the command shorter:

/setblock 262 73 -253 minecraft:command_block[conditional=false,facing=east]{Command:'/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}'}

I suggest doing that in a text editor, as it is easier to format text there and the minecraft chat line is limited and cuts the end of the command. A command block is limited, too, but the limit is much higher. It is still not optimal for editing long commands though.

This works for creating /summon commands, too, simply look at an entity instead.